Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Date formatting exporting to Excel

Date formatting exporting to Excel

Date formatting exporting to Excel

I use the following code to export a Query to Excel 2003

CODE -->

Dim strQryName As String, strXLFile As String, strName As String
strQryName = "QryBillingMailMerge"
strXLFile = "F:\weeklybilling.xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, strQryName, strXLFile
FollowHyperlink "F:\weeklybilling.xls" 

The problem I am having is the exported sheet go to a Canadian company. They format their dates YYYY/MM/DD, Mine are formatted MM/DD/YYYY. I have the format set to YYYY/MM/DD in the QryBillingMailMerge Quesry but when it exports it reverts to MM/DD/YYYY. How can I remedy this?

Thank You

RE: Date formatting exporting to Excel


A Date/Time value, both in Access and Excel is a NUMBER. Today's Date Value, Oct 23 2016, is 42666. What you see DISPLAYED is a formatted date. Whether the FORMAT is yyyy/mm/dd or mm/dd/yyyy, there is ONE underlying numeric value for any date. You can change the Number Format for your dates. Select the date range, right-click in the selection and select Format Cells... > Number TAB, and select an appropriate Date format.

BTW, if you change the Number Format for any Date to GENERAL, you will see displayed the Numeric Date Value, also called the Date Serial value. In Excel Date Serial ZERO is 1900/01/00. Excel does not allow negative Date Serial values.


glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close