Importing via VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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.
 
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.
 
Back
Top