Change the name of a field and/or it's data type in a macro?

E

EPratt

I am trying to write a macro to import data from another db into Access. I
then need to change the names of some of the fields (they are pretty cryptic)
and I also need to change some of the data types. They all come over as
text. Can this be done in a macro?
 
S

Steve Schapel

EPratt,

Two approaches I can think of, which you might like to look into...

1. Have a blank table already created in your database, with the fields
set up as you require. After import, regard the table imported into as
"temporary", and run an Append Query to move the data into the correct
table, and then delete the imported table.

2. Use a RunSQL action in your macro to run a Data Definition Language
query, using the ALTER TABLE statement, I am pretty sure you will be
able to change the table definition to how you want, though I haven't
had much experience myself with this type of approach.
 

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