TransferSpreadsheet Problem

  • Thread starter Thread starter Elka
  • Start date Start date
E

Elka

I need to import Excel spreadsheet into Access
table "rate". I am using the following code:
DoCmd.TransferSpreadsheet acImport,
acSpreadsheetTypeExcel7, "rate", vrtSelectedItem, no

The data is imported just fine, but when I run a query
involving table "rate", the query displays an input box
for me to enter rate.Field1 value. My interpretation of
this is that the query does not see table "rate".
Another thing, if I import the same spreadsheet using the
Import Spreadsheet Wizard, the query runs fine. I
compared "rate" table created with the wizard and in code,
the design looks exactly the same. What am I missing in
my code? Please help.

Thank you in advance.
 
What this means is that your query either doesn't have the table "rate" in
it, or else there is no field named "Field1" in the table "rate".

Post your SQL statement and let's see what you have. Also, post the names of
the fields that are in the "rate" table.
 
Hello Ken,
Thank you for the reply. I checked the field names. The
problem was in the field names. When the table in created
using the wizard with "HasFieldNames" = False, the field
names are Field1, Field2, etc... But when table is
created with the TransferSpreadsheet method, the field
names are F1, F2, F3 etc. I am using Access 2003.

Maybe this will help somebody else.
Thank for your help. It works now.
 
Back
Top