Importing Error

CBragg

VB Dummy
Local time
Today, 23:14
Joined
Oct 21, 2002
Messages
89
When im importing data from excel using either VBA or a macro i occasionally get an error saying:

Field 'F1' does not exist in 'TableName'.

I dont think this is to do with my data in excel or access as ive tested it with just one bit of info in. My imports work when i do it manually though 'Get external data' . Also i dont think that my code or the macro were set up wrongly.

Is this my MS Access installation?

Any ideas would be greatly appreciated as this is a pain.

Cheers,
 
What is happening is that somewhere in one of the cells outside of the parameters of what you are trying to import, somehow a space got inserted in one of the cells. So, Access will try to import that column, which defaults to the name "Field1" and since you don't have "Field1" in your table, it is alerting you to that fact.

You can solve that problem by either making sure that all you specify only the columns you want to import within your TransferSpreadsheet code.
 
Cheers, i'll try and specify a range next time.

However there is one thing, ive got this error when only entering data in one cell in an excel spreadsheet and didnt click anywhere else then tried to import it, as a test.

Any ideas??
 
The only other thing I would think to look for would be within the Import Specification to see if any field is named Field1 and there isn't one within the table.
 
Ive already checked that as this happens in different databases, and i can import the same spreadsheets manually using the 'get external data'

Cheers anyway.
 
I didn't quite understand your last post. Did you say that you get the error when doing the import manually as well?
 
Sorry, no when i do it manually everything works fine, even with the same spreadsheets and also .txt files.

It is just happeneing when i either set a macro up or write it in VBA.
 
If it doesn't happen when you do it manually, but it does when you automate, it would point to something being wrong in either the Import Specification (and if you don't use one, you should), or in the TransferSpreadsheet code, or like I had originally said, that there is a space somewhere in the spreadsheet.

But, since you say you took a brand new spreadsheet and tried and it did it, that would seem to eliminate the space problem. So, it would seem to me that the Import Specification is suspect.
 
Cheers, i think i'll re-install my Ms Access!!
 

Users who are viewing this thread

Back
Top Bottom