TransferText macro - need Access to create index

G

Guest

I am running Access 2003. Per Steve Schapel's suggestion, I am trying to
create a macro so users can repetitively import data into a database.

I can't figure out how to get Access to created an indexed field when it
runs the macro. When I do a manual File > Get external data, I can select to
have Access create an index. I can't seem to do this in the automated
TransferText method. I've looked in the help and read the TransferText posts
here but I'm just not seeing what I'm doing wrong. I've gone through the
File > Get external data process several times to save the import
specifications. I'm saving the specifications at the very last step of the
import process.

As always, thanks for any help you can give me.

Ann Scharpf
 
K

Ken Snell \(MVP\)

By "index", do you mean a primary key with unique values? If yes, why not
just import into an existing table that has an autonumber field as the
"last" field (so that the text file will not try to use it). You can delete
all records from the table before you import the next text file.
 
G

Guest

Aha! I didn't realize I could have the key field be the LAST field in the
table. And that, by putting a field at the end, the import wouldn't try to
use it. I kept getting an error that said "Microsoft Office Access was
unable to append all the data to the table." because I had the Autonumber ID
field at the beginning of the record when I tried this before.

Thanks! I never would've thought of trying this.

Ann
 

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