Rahul Gupta
Rahul Gupta

Reputation: 1802

Report to excel Date format Conversion

I have a report that uses a single query as record source to generate a report. I am exporting that report into Excel with following code

DoCmd.OutputTo ObjectType:=acOutputReport, ObjectName:=strReport, OutputFormat:=acFormatXLS, outputfile:=strpath & strTempFile, AutoStart:=False

All the data in the report is correct except for date, where date format is displayed as Genereal Number (Not sure which format)

Any help is appricaited. Thanks.

Upvotes: 0

Views: 260

Answers (1)

tmit
tmit

Reputation: 83

Excel is displaying the date to you in the way excel 'sees it', rather than in a user friendly date format.

In excel, every date has a value that is a number. This allows excel to perform calculations/do things with dates (example - checking the days between two dates).

If you reformat your excel doc (right click on a random date and click format and then change to date) you'll probably find you have the correct date exported.

Probably haven't answered your question, but if you're just doing a data dump then you may not need to export the formatting (because you can just simply show the date in date format on your report).

Upvotes: 1

Related Questions