Macro Import

  • Thread starter Thread starter ladybug via AccessMonster.com
  • Start date Start date
L

ladybug via AccessMonster.com

I have a a macro that imports data into a database table. I am receiving an
error when button is clicked on,
Field 'F5' doesn't exist in destination table 'tblTempProduction2"

What is the F5 referring to?
 
That is what I figured. The problem is I don't have anything in the fifth
field. I think it may be something in my code. The Event Procedure has the
following:

'Import data to temp tables
DoCmd.TransferSpreadsheet acImport, 5, "tblTempProduction2",
strProduction, True

Sorry, I don't understand VBA. I only have four columns that I am importing.
When I cange the 5 above to 4, I get the error:

A value you entered for the spreadsheettype argument is invalid.

Any suggestions?
 
Assuming that strProduction is a path to the spreadsheet, try:
DoCmd.TransferSpreadsheet acImport, 5, "tblTempProduction2",
strProduction, True, "D1:Dx"
where x is the last row of column D that you want transferred.
Here's a hint. In the module, move the cursor over the command you don't
understand (TransferSpreadsheet in this case) and press F1. It will usually
show you how to use it.

That is what I figured. The problem is I don't have anything in the fifth
field. I think it may be something in my code. The Event Procedure has the
following:

'Import data to temp tables
DoCmd.TransferSpreadsheet acImport, 5, "tblTempProduction2",
strProduction, True

Sorry, I don't understand VBA. I only have four columns that I am importing.
When I cange the 5 above to 4, I get the error:

A value you entered for the spreadsheettype argument is invalid.

Any suggestions?
The fifth field (column) in the file you're trying to import.
[quoted text clipped - 4 lines]
 
Back
Top