Results 1 to 6 of 6
  1. #1
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    281

    Export to Excel Using Date/Time Stamp


    I figured Google would have had the answer - Nope...

    Need to export from Access to Excel and save the file with Date/Time stamp...

    I have tried several variations of the below code - and, well - I'm here.
    Code:
    DoCmd.TransferSpreadsheet acExport, , "QryTktRqstArch", "N:\Management\Internal\@DeptCommon\TEAMS\TktRequests\TktRequestFor_" & Format(Now(), "mm-dd-yyyy hh:mm") & ".xlsx", False
    Receiving a 'can't save file' error...

    Thanks as always...

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    the colon cannot be used in file names, along with /\?*"|<>

  3. #3
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    281
    Oh Geez.... jsmh...

    Thanks Aj

    For future readers:

    Solved With This:
    Code:
    DoCmd.TransferSpreadsheet acExport, , "QryTktRqstArch", "N:\Management\Internal\@DeptCommon\TEAMS\TktRequests\TktRequestFor_" & Format(Now(), "mm-dd-yyyy hhmm") & ".xlsx", False

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    Umm, can you transferspreadsheet into a file that doesn't exist? I don't believe so.
    Don't see a problem with the colon either. It isn't part of the filename as far as I can see. It's part of the path, which should be ok.

    EDIT: OK, so I copied both of the statements into notepad because I couldn't see a difference here. Even there, they look exactly the same, so how did the 'solution' work
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    "mm-dd-yyyy hh:mm"

    became

    "mm-dd-yyyy hhmm"

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    Wow. Need new glasses!
    Thanks.

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

Similar Threads

  1. Time/Date stamp Location
    By Western_Neil in forum Database Design
    Replies: 6
    Last Post: 07-10-2016, 09:29 AM
  2. Stamp date, time and user?
    By ricanos in forum Modules
    Replies: 1
    Last Post: 04-06-2016, 08:41 AM
  3. Replies: 1
    Last Post: 04-01-2015, 01:29 AM
  4. Export Report to Excel without Date() and Time()
    By agent- in forum Import/Export Data
    Replies: 5
    Last Post: 12-21-2011, 08:55 AM
  5. Date and Time Stamp
    By zoooza84 in forum Access
    Replies: 2
    Last Post: 08-06-2011, 04:53 AM

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