Link to home
Start Free TrialLog in
Avatar of Robert Schumann
Robert SchumannFlag for United States of America

asked on

Add "Date" to file name

Hi, using the following cmd in a form.

DoCmd.TransferSpreadsheet acExport, 10, "data", "d:\data\ArdFlashData.xlsx", True

Would like to add the date in the file name

example  ArdFlashData_01/02/2016.xlsx

Not sure how to incorporate    =NOW()  so it will show the date in the file name.

Thanks
Bob
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Robert Schumann

ASKER

Works Great!!

Just had to remove the "/" in the date format.  Replaced with a "-"

Thank you!!
Thanks for the quick replay and great solution!
When I append dates to file names, I prefer to use yyyymmdd order for the date parts so the files will sort correctly in chronological order.
Good point.

I was also trying to add the time in addition to the date.  Can't seem to get it to work.

ie:    2016-01-24  14:25:26

Any suggestion?
call me a fuddy duddy but I really hate to see embedded spaces and special characters in file names.

format(now(), "yyyymmdd_hhnnss")

The Format() function is your friend.  It would help you to look it up in help and read about what it can do to dates and numbers.
Agree.