Importing spreadsheets in Access 2000

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
 
P

pietlinden

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.
 

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