Add a primary key via a macro

D

Diane, St. Louis

Hi - I am stuck. I have a macro that uploads text files via the "transfer
text" action. I
saved the import specification that I need and all works well EXCEPT for the
primary key. I selected "Let Access add primary key", but it doesn't add it
when I run the macro. When I upload the file by hand and select the import
specification, the primary key is inserted. But when I run it via the macro,
it isn't. What can I do to get primary keys added without having to upload
each file by hand?
 
J

John W. Vinson

Hi - I am stuck. I have a macro that uploads text files via the "transfer
text" action. I
saved the import specification that I need and all works well EXCEPT for the
primary key. I selected "Let Access add primary key", but it doesn't add it
when I run the macro. When I upload the file by hand and select the import
specification, the primary key is inserted. But when I run it via the macro,
it isn't. What can I do to get primary keys added without having to upload
each file by hand?

Are the files all of the same structure - fields and datatypes? What are you
uploading them into: separate tables?

I wonder if it might make more sense to have a single table set up, with an
autonumber primary key; and import the files *into* this table. You could have
an additional field to indicate which file was the source of the data; link to
the files and run Append queries to import the data.

John W. Vinson [MVP]
 

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