Renaming a text file

  • Thread starter Thread starter Guest
  • Start date Start date
I got several text files linked to the database, I want to export them into
an external folder.I can do the export but before export the names should be
renamed in to like Rea181"DDMMYY"_1.txt, any idea what should be the code
for changing the names, I use
docmd.TransferText acExportFixed ,specification Name, TableName,FileName
But I dont know how to include DDMMYY in the file name
Thanks
 
Assuming you're setting FileName like:

FileName = "C:\MyFolder\Rea181_1.txt"

change it to

FileName = "C:\MyFolder\Read181" & Format(Date(), "ddmmyy") & "_1.txt"

In my opinion, though, you'd be better off using yyyymmdd so that the file
names will sort properly.
 
Back
Top