Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autonumber as field for import text??

Status
Not open for further replies.
Aug 2, 2000
325
0
0
US
Hi all!

I can't seem to find any information on importing a text file, using a saved import specification but having an autonumber field added on when it imports.

Any help would help a heap,
Thanks

Dave
 
IMport the text file once "manually"....On the last wizard screen, before you click finish, click the advanced button. Add the AutoNumber field here and save the spec. Import through DoCmd.TransferText.

****************************
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
If you import the text file and on the next to last screen of the import wizard "let microsoft add primary key" it will add an autonumbered field as the primary key called "ID"
 
These are great idea's however, this will be a process repeated throught the month and needs to be automated. The autonumber field is not an option for data type when you save the import specs.
I'm running A97 and I'm trying to build a macro with the TransferText method in which you can select which import spec to use. But that doesn't do any good because the "let Microsoft pick primary key" doesn't save in the spec.

Any thoughts????
 
If you have exhausted all our suggstions and none work for you, your last option is to create a custom import routine using the FileIn/FileOut VBA code, doing you own custom identification and adding the autonumber field as you go...

****************************
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top