Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incrmental File Name

Status
Not open for further replies.

mlocurci

MIS
Oct 17, 2001
210
US
I have a Macro that I created to run a query and produce a file daily. I want to name the file YYYYMMDD, but I can't figure how how to dynamically change the file name. Ideas?
 

And how do you run the macro? Through code or using the MS Access enviroment pressing the ! button on Macros?
 
I actually use MS Schuduled Jobs. I have a Bat file run the macro for me.
 

Convert the macro to Visual Basic. Go to Modules, find that macro converted, open the module. In the sub created, somewhere you 'll find the name of file saved in a path.
Change it to "c:\path\filename" & format(Date, "yyyymmdd") & ".xls" or something to your needs.
At the top, change the Sub word to Function. Create a new macro that runs the function and substitute the old macro name you had with this new one!

Post if you need help on the Module stuff

 
i am going to have to admit, I don't know how to move from the macro to the VB. Help would be appreciated.
 

Select the Macro. On menu Tools-->Macro-->Convert Macros to
Visual Basic

Welcome to a new world of fun and joy!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top