Importing spreadsheets in Access 2000

  • Thread starter Thread starter Del
  • Start date Start date
D

Del

I am using TransferSpreadsheet method to import Excel files into Access 2000.
I want to use the data in the first record as the field names but one of the
fields has a dash in it. When I set hasfieldnames = true all it does is
delete the first record and the field names remain F1, F2, etc. How can I
get around this? I have no control over the names assigned in the
spreadsheet columns and I don't want my users to have to open the spreadsheet
and make changes before they import it.

The code I'm using is:
DoCmd.TransferSpreadsheet , , Me.txtExcelTableName, Me.txtImportPath,
intFieldName
 
I am using TransferSpreadsheet method to import Excel files into Access 2000.
 I want to use the data in the first record as the field names but one of the
fields has a dash in it.  When I set hasfieldnames = true all it doesis
delete the first record and the field names remain F1, F2, etc.  How can I
get around this?  I have no control over the names assigned in the
spreadsheet columns and I don't want my users to have to open the spreadsheet
and make changes before they import it.

The code I'm using is:
  DoCmd.TransferSpreadsheet , , Me.txtExcelTableName, Me.txtImportPath,
intFieldName

Create the destination table first. Then create an import
specification by running an import manually the first time. Save the
Spec with a name. Then you can use it in the future
TransferSpreadsheet commands.
 
Back
Top