Creating a variable to change the name of an export file

F

fresh

I have a database that I periodically export to a text file for a Word mail
merge. I have a query that finds all of the records with a null export date
and a query that updates the export date to now().

I have a macro that runs the first query, uses TransferText to send it to a
file, then runs the update query. However, the file name in TransferText is
"hard wired" so whatever was there before gets written over.

Is there a way to create within the macro an environmental variable for the
file name based on date/time so that I can keep these export files?
 
J

Joe Fallon

I would use VBA code.
The macro may accept something like this:

MyExportPath = myDir & Format(Now(), "yyyyMMddHHmmss") & ".txt"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top