CSV Import Error

E

Erick C

Hi everybody.
I am having a problem with a CSV file that I am tryingto import. I
have some code that is used to bring up a window so the user can
select a file to import. The only problem is it is written for use
with xls files.
I now need to import CSV files and I was trying to use the same code.
I am getting an error that says "External table is not in the expected
format"
and the debugger highlights:
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
strTable, strPathFile, blnHasFieldNames
I think that it is the "acSpreadsheetTypeExcel9" that is giving me
problems, but I do not know what to update it to in order for it to
bring in CSV rather than xls. I know that the number represents
different versions of excel, but I do not know if there is a
designation for csv files as well. Can anybody help me out?

Thanks!
Erick
 
P

pietlinden

Hi everybody.
I am having a problem with a CSV file that I am tryingto import.  I
have some code that is used to bring up a window so the user can
select a file to import.  The only problem is it is written for use
with xls files.
I now need to import CSV files and I was trying to use the same code.
I am getting an error that says "External table is not in the expected
format"
and the debugger highlights:
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
      strTable, strPathFile, blnHasFieldNames
I think that it is the "acSpreadsheetTypeExcel9" that is giving me
problems, but I do not know what to update it to in order for it to
bring in CSV rather than xls.  I know that the number represents
different versions of excel, but I do not know if there is a
designation for csv files as well.  Can anybody help me out?

Thanks!
Erick

You need to use TransferText with CSV files, not TransferSpreadsheet.
 
E

Erick C

TransferText!!!
Of course I need to use that! Thank you!
It always makes so much more sense once someone points out the most
obvious things to me! Hopefully I can learn this vba and sql stuff a
little more quickly.

Thanks again!
 

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