Share via

Export to Excel from Access fields format issue

Anonymous
2015-05-05T15:09:44+00:00

Hello,

I have a query in Access and need to export the data to Excel worksheet. I was able to export to Excel just fine, but the result format in some fields are messed up, like date field would return a 5 digital numbers, whereas a number would return like data field. Also, issue with decimal places in number fields.

In Access query, I formatted the field with specifying fixed decimal places like Format(expression, "0.00") and date as Format(expression, "short date").

How do I changed the Access query so instead of formatting the field, actually changed the field to specified decimal or whole number or date field?

Thanks for all the help.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2015-05-05T16:54:26+00:00

    Bill,

    The data will be exported to Excel each time users run the macro, which means users have to format the fields in Excel each time? Is there a way around this? Thanks

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2015-05-05T17:30:02+00:00

    I normally create a custom export function in which I can automatically format columns, fix the layout, apply formatting...

    I normally keep my export query as basic as possible, and do all the formatting in my code.

    Here is a sample that you can use to get you going: http://www.devhut.net/2012/04/19/ms-access-vba-export-records-to-excel/

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2015-05-05T15:57:12+00:00

    When you use Format() on a date the data type gets changed to a string so "5/5/2015" ends up looking to Excel like 5 divided by 5 divided by 2015. Remove the format function and do the formatting in the excel sheet itself. Same goes for the numeric precision.

    Was this answer helpful?

    0 comments No comments