Results 1 to 5 of 5
  1. #1
    Johnny12 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2012
    Posts
    31

    Export File Name with Date

    I know how to export a file as excel and put todays date in the file name, but I need a date from within the database. When we run our orders report, its runs one business day after the orders are placed. So Monday's orders go on Tuesday's reports. OK easy, use todays date -1. When running the report on Monday for Fridays orders, its a little more complicated but I can figure it out. But its not always that simple. Holidays or other days off complicate it and have me stumped. If its a three day weekend, we run Fridays report on Tuesday.



    Within the report itself, its easy, I set up a prompt so I have to enter the date the reports are for. Is it possible to use this same prompt or something else to apply the correct date to the file name when exported as an excel file?

    Thanks in advance!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Most of us would use a form to gather user input. It gives you more control. If you used a form, it could be used as both the criteria for your report and the source of the value for the file name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    You could have a field in a settings table that holds the next date to process, and update as required.?
    So if you ran it today, it would put today's date in after picking up yesterdays date.

    After a bank holiday Monday, you would get the Friday date (or Thursday if Easter) and use that for the report, then update to that days date, ready for the next run?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    Johnny12 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2012
    Posts
    31
    OK, how do I call the date from the table for the file name?

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Quote Originally Posted by Johnny12 View Post
    OK, how do I call the date from the table for the file name?
    I would use DLookUp()
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Replies: 3
    Last Post: 02-25-2018, 02:53 PM
  2. Export file with date
    By adnancanada in forum Import/Export Data
    Replies: 8
    Last Post: 12-07-2017, 01:23 PM
  3. Export File Name with Today's Date
    By sombiatz in forum Macros
    Replies: 2
    Last Post: 07-30-2014, 08:43 AM
  4. Replies: 3
    Last Post: 06-18-2013, 01:14 PM
  5. Date/time export to CSV file
    By kaptin in forum Import/Export Data
    Replies: 3
    Last Post: 05-08-2011, 06:57 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