Import button issue in the form

G

Guest

I am trying to automate system.
I have button 'Import Excel'.
Here is my code behind the button:

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel4,
"tblImportData", "C:\Data.xls", True

When I click on Command button, i get this message error:

"Field 'Name' doesn't exist in destination table 'tblImportData' ."

But I do have a field name in this table.

Please tell me What is wrong with this code or tell me any other way to do it.

Thank you so much.
 
N

Nikos Yannacopoulos

Very likely the problem is that you are using an Access reserved keyword
(Name) as a table field name (the latter use of the word is indeed what
Name is, a property to an object!). This tends to create this kind of
problem, Access not being able to distinguish an object (field in this
case) from a property.

Try changing the field name to something else (both sides, access table
and spreadsheet) and try again.

HTH,
Nikos
 
G

Guest

I did change field name and I stil have same error.
I did even try to import from "File-Get External Data-Import", I unable
import the excel file.
??????????
 
G

Guest

I had extra space, now is working.

Thank you

GGill said:
I did change field name and I stil have same error.
I did even try to import from "File-Get External Data-Import", I unable
import the excel file.
??????????
 

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