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
Robert SchumannFacilities PlannerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
DoCmd.TransferSpreadsheet acExport, 10, "data", "d:\data\ArdFlashData_" & Format$(Now(),"mm/dd/yyyy") & ".xlsx", True

Jim.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Robert SchumannFacilities PlannerAuthor Commented:
Works Great!!

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

Thank you!!
Robert SchumannFacilities PlannerAuthor Commented:
Thanks for the quick replay and great solution!
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

PatHartmanCommented:
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.
Robert SchumannFacilities PlannerAuthor Commented:
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?
PatHartmanCommented:
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.
Robert SchumannFacilities PlannerAuthor Commented:
Agree.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.