Solved Exporting form to Excel produces different field names depending on Form or Datasheet view

noaccessidea

New member
Local time
Today, 11:31
Joined
Nov 29, 2019
Messages
14
If I export this form to Excel I get different field names depending on whether I am in form view or datasheet view. One in particular is 'DayofWeek_ID', this is listed as 'Day' on the form and in the original query it is pulling the data from. The order of the fields is also different in the two exports.

Can anyone help me figure out why this is happening? I want to use the form view but I want the field/column order and field names to be as they are in the datasheet view export.
 

Attachments

when you export data, you export the query, not the form. Your query includes DayofWeek_ID even if it is not on the form. You have a separate column for 'Day' which is on the form and the query.

I note you are using a split form. Split forms do have their own particular issues - this may be one of them. And you are using a macro which I don't use so cannot advise.

I would modify your query to show only the fields you want to export and in the order you want the columns - then export the query - look to use docmd.transferspreadsheet
 
I agree with CJ_London that using docmd.transferspreadsheet is a better way.

The best method I have found for saving a form or report to Excel is to create a query just for the export. This allows you to change the query to match your desire format without impacting the form or report. You can change the column names (field names, add calculated fields to match the form, etc.
 

Users who are viewing this thread

Back
Top Bottom