TransferSpreadsheet trouble

G

Guest

I am trying to import an excel spreadsheet w/a header row into an existing
table named "TransferTable". I want to overwrite the existing table with the
spreadsheet. I am getting error 13 when trying to run the following:

DoCmd.TransferSpreadsheet acImport, "TransferTable",
"D:\Quality\September.xls", True

Am I out in left field by trying to do it this way? Any reccomendations?
 
R

Rob Oldfield

You're missing an argument. Should be something like....

DoCmd.TransferSpreadsheet acImport, "TransferTable",,
"D:\Quality\September.xls", True

to use the default spreadsheet format or...

DoCmd.TransferSpreadsheet acImport, "TransferTable",acSpreadsheetTypeExcel9,
"D:\Quality\September.xls", True

to specify a particular format.
 
G

Guest

Thnx for the quick response. I think you had a typo in your response. You
were correct I was missing an argument but I belive the missing argument goes
before "TransferTable" like:
DoCmd.TransferSpreadsheet acImport,, "TransferTable",
"D:\Quality\September.xls", True

However I'm now getting err 2391.

FYI...I also tried it exactly as you typed it but still got err 13.
 
R

Rob Oldfield

Oops. Wrong place. Make that...

DoCmd.TransferSpreadsheet acImport,, "TransferTable",
"D:\Quality\September.xls", True
or
DoCmd.TransferSpreadsheet acImport,acSpreadsheetTypeExcel9, "TransferTable",
"D:\Quality\September.xls", True
 
R

Rob Oldfield

What happens if you try importing the file manually? If you get a complaint
about a field name then that may well be your problem. If not, what's the
rest of the error that you're getting?
 
G

Guest

Thanks for your help Rob. I can import manually fine. However I have
abandoned the acImport method and switched to acLink. Everthing going
smoothly now. Thanks again for your assistance.
 

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