By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,656 Members | 1,917 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,656 IT Pros & Developers. It's quick & easy.

Bypass autonumber

aas4mis
P: 97
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.TransferText acImportDelim = "|", , "tblRegular08", "S:\CSS Folder\2008 Freight Info\CSSSEKO.txt", 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?
Feb 5 '08 #1
Share this Question
Share on Google+
6 Replies


jaxjagfan
Expert 100+
P: 254
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.TransferText acImportDelim = "|", , "tblRegular08", "S:\CSS Folder\2008 Freight Info\CSSSEKO.txt", 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.
Feb 5 '08 #2

NeoPa
Expert Mod 15k+
P: 31,712
I'd use a file import/export specification. Possibly even using column names if you have that much control over the data.
Feb 5 '08 #3

aas4mis
P: 97
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?
Feb 5 '08 #4

NeoPa
Expert Mod 15k+
P: 31,712
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).
Feb 5 '08 #5

aas4mis
P: 97
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!
Feb 8 '08 #6

NeoPa
Expert Mod 15k+
P: 31,712
Excellent. Pleased to hear it :)
Feb 9 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.