Results 1 to 6 of 6
  1. #1
    mp3909 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    154

    Date/Time format


    I am exporting the result set of query into a csv file using to DoCmd.TransferText method.

    The table query shows the date columns as just DD/MM/YYYY which is what I want.

    But when I open up the csv file after exporting the data, those columns have "00:00:00" appended in the cells so it is now like "DD/MM/YYYY HH:MM:SS".

    How do I solve?

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Replace your original date field in your query with this calculated field:
    CalcDate: FORMAT([Original Date Field],"dd/mm/yyyy")

    That converts it to a text value, so it won't add anything to it, and be exported exactly as it looks.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    The table query shows the date columns as just DD/MM/YYYY which is what I want.
    to add to your understanding, what you see is the result of using a format property, the underlying value remains unchanged. When you export or import data, it is the underlying value that is used, the format property is not exported. What Joe's solution does is use the format function - which converts the underlying value into a text field which is then exported instead of the underlying value.

  4. #4
    mp3909 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    154
    Is it possible to do this for a union query?
    I can't view a union query in design view, so I am wondering how it is possible to do as per your instruction.

  5. #5
    mp3909 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    154
    It's ok, I guess the only workaround this is to create a query with the underlying tables being the tables derived from the union query.

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    Is it possible to do this for a union query?
    you have to edit the sql

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 09-16-2018, 04:58 PM
  2. Date Format and Time
    By adnancanada in forum Access
    Replies: 2
    Last Post: 02-23-2017, 10:47 PM
  3. Format date and time query
    By wolfm in forum Queries
    Replies: 5
    Last Post: 02-09-2016, 05:00 PM
  4. Format date and time query
    By wolfm in forum Queries
    Replies: 2
    Last Post: 10-26-2015, 08:34 AM
  5. Replies: 3
    Last Post: 08-20-2014, 01:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums