Importing Textfiles

G

gottahavit

I am trying to set up a macro that imports data from a text file using one of
the Import Specifications I have set up.
When it imports, I want Access to add a primary key (just as it would if you
mannually went through the Import Wizard where it adds a column at the far
left with each row numbered).
Is there anyway to set this up? Would it be done in the Specs part of the
macro part?

Thanks.
 
K

Ken Snell \(MVP\)

Create the table into which you want the data to be imported. Ensure that
there is a field for each data item in the text file to be imported. Then
add one more field as the "last" field, and set it to Autonumber type, and
then make it the primary key.

Then have TransferText import to this table. Because the last field is not
in the text file, it'll be ignored by ACCESS, but it will function as the
autonumber / primary key field that you want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top