Executing the import table wizard

G

Guest

Hi all.

I'm trying to enhance the functionality of a MS Access application.

I want to give the user the capability to import a MS Access or MS Excel
table into the application *without* having to execute the Import Wizard
herself.

Q1:
So i'm basically looking for the VBA statement that will invoke the Import
Wizard (the equivalent of right-clicking in Tables view and choosing: Import).

Q2:
Is there a way to capture the name of the table that's being imported?
I will need to append it to another one once the user has imported it.

If not, i was thinking to simply capture all the table name before the user
starts the Import Wizard and after he's done so, so the difference would give
me the name of
the newly imported table.

Many thanks for your help,
Alex
 
T

Tim Ferguson

I want to give the user the capability to import a MS Access or MS Excel
table into the application *without* having to execute the Import Wizard
herself.

All you have to do is to collect enough information to get the source (file
name and path, sheet name or table name) and the destination (table name);
then construct a SELECT * FROM ... IN [...] INTO ... command and run it.
Is there a way to capture the name of the table that's being imported?
I will need to append it to another one once the user has imported it.

It sounds as though you'll have to do a load of checking to make sure that
the table's fields and data types match up: it's a simple matter of
iterating the Fields collection of each object. A bit harder is deciding
how to recover and respond intelligently to the user when it goes wrong.

best of luck


Tim F
 
G

Guest

Thanks for the suggestion Tim, i was going for the:
Docmd.RunCommand(acCmdImport) statement


Tim Ferguson said:
I want to give the user the capability to import a MS Access or MS Excel
table into the application *without* having to execute the Import Wizard
herself.

All you have to do is to collect enough information to get the source (file
name and path, sheet name or table name) and the destination (table name);
then construct a SELECT * FROM ... IN [...] INTO ... command and run it.
Is there a way to capture the name of the table that's being imported?
I will need to append it to another one once the user has imported it.

It sounds as though you'll have to do a load of checking to make sure that
the table's fields and data types match up: it's a simple matter of
iterating the Fields collection of each object. A bit harder is deciding
how to recover and respond intelligently to the user when it goes wrong.

best of luck


Tim F
 

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