By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,506 Members | 2,311 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,506 IT Pros & Developers. It's quick & easy.

Access ImportSpreadsheet and Wizard Give Different Default Field Names

P: 7
I am using Access 2003. I've been importing Excel 2003 spreadsheets using the wizard in Access for some time now. The spreadsheet does NOT have the column names in the 1st row, so the wizard names them "Field1", "Field2", etc., by default. I decided to automate the process and I am using the following line of code:

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, strFileName, FileSpec, FieldNamesInRowOne

The argument for FieldNamesInRowOne is passed either true or false, depending on my needs

When I pass it false, it works fine, but it names the fields "F1", "F2", etc.

I'm looking for an answer as to why the default field names are different. And is there a setting somewhere for the import wizard's default field name assignments?

I won't complicate it too much by adding more, but I will just say I have all of the imported files archived. It would be very useful if they all had the same field names, regardless of how they were imported.
Mar 5 '08 #1
Share this Question
Share on Google+
1 Reply


Denburt
Expert 100+
P: 1,356
You should be able to use a schema for that although you would need to use TransferText instead or first import the sheet then rename the fields.

CurrentDB().TableDefs(TableName).Fields(CurrentFie ldName).Name =
NewFieldName

As far as explaining the methodology of Microsoft..... lol Probably had different groups on different projects and they did not catch that. Since renaming the fields or using a schema can be done easily enough they probably didn't think it was a major issue. Good luck let me know how it goes.
Mar 5 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.