Importing via VBA

E

Ernst Guckel

Ok... so I have now exported the data from excel and can import the data
with the import wizard into an existing table but my VBA code gives me an
error when I try to automate it...

DoCmd.TransferText , , "tblImport", sFile, False

The error I get is:

Field 'F1' does not exist in destination table 'tblImport'

but everything works with the wizard... and the field structure is fine from
what I can see... Am I missing something?

Ernst.
 
P

pietlinden

Ok... so I have now exported the data from excel and can import the data
with the import wizard into an existing table but my VBA code gives me an
error when I try to automate it...

DoCmd.TransferText , , "tblImport", sFile, False

The error I get is:

Field 'F1' does not exist in destination table 'tblImport'

but everything works with the wizard... and the field structure is fine from
what I can see... Am I missing something?

Ernst.


Yes.. The Import Specification Name is missing... the database has no
way of knowing how to map the Excel columns to fields in your
destination table. So create an import spec, name it (use the
advanced tab) and then specify it in the TransferText command.
 
E

Ernst Guckel

Your wonderful. Thanks...

Yes.. The Import Specification Name is missing... the database has no
way of knowing how to map the Excel columns to fields in your
destination table. So create an import spec, name it (use the
advanced tab) and then specify it in the TransferText command.
 

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