Bypass autonumber

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aas4mis
    New Member
    • Jan 2008
    • 97

    Bypass autonumber

    I have a text file that I'm trying to import. my table is setup as:

    ID: Autonumber PK
    Toship: text
    Pickup Number: Text
    Order Detail: Text
    and a few others that aren't relevant.

    My problem is upon import with "DoCmd.Transfer Text acImportDelim = "|", , "tblRegular 08", "S:\CSS Folder\2008 Freight Info\CSSSEKO.tx t", False" the Toship is overwriting the PK and all the values are shifted to the left one field. Is there something I need to do when importing to a table with a PK?
  • jaxjagfan
    Recognized Expert Contributor
    • Dec 2007
    • 254

    #2
    Originally posted by aas4mis
    I have a text file that I'm trying to import. my table is setup as:

    ID: Autonumber PK
    Toship: text
    Pickup Number: Text
    Order Detail: Text
    and a few others that aren't relevant.

    My problem is upon import with "DoCmd.Transfer Text acImportDelim = "|", , "tblRegular 08", "S:\CSS Folder\2008 Freight Info\CSSSEKO.tx t", False" the Toship is overwriting the PK and all the values are shifted to the left one field. Is there something I need to do when importing to a table with a PK?
    What I normally do when importing data from Excel or Text is to import it to a tmp table first and then work with the data from there.

    Open table in design view and move the PK (ID) field to the end. Forms and queries don't care where it is as long as it exists.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32668

      #3
      I'd use a file import/export specification. Possibly even using column names if you have that much control over the data.

      Comment

      • aas4mis
        New Member
        • Jan 2008
        • 97

        #4
        Originally posted by NeoPa
        I'd use a file import/export specification. Possibly even using column names if you have that much control over the data.
        I've tried creating an import specification and don't know where it's saved or how to use/refer to it?
        How would I go about creating and using an import specification?

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32668

          #5
          Do an export manually and select Advanced. Set up the spec and save it with a name. In the TransferText command there is a parameter for the specification (2nd parameter).

          Comment

          • aas4mis
            New Member
            • Jan 2008
            • 97

            #6
            Originally posted by NeoPa
            Do an export manually and select Advanced. Set up the spec and save it with a name. In the TransferText command there is a parameter for the specification (2nd parameter).
            Thanks, Working great!

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32668

              #7
              Excellent. Pleased to hear it :)

              Comment

              Working...