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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Name Text Files 1

Status
Not open for further replies.

doile

Technical User
Jun 12, 2001
14
0
0
US
Using TransferText to create .txt files for uploading. Is there a way to name these files based on time and date automatically?
 
In a VBA module you can create the file names and then use DoCmd.TransferText method rather than a macro TransferText action.

Private Sub cmdExport_Click()
Dim file_name As String, tbl_name As String
file_name = "c:\data\export\ex" & Format(Date, "yymmdd") & ".txt"
table_name = "Depts"
DoCmd.TransferText acExportDelim, , table_name, file_name
End Sub
Terry

"I shall try to correct errors when shown to be errors, and I shall adopt new views so fast as they shall appear to be true views." - Abraham Lincoln
 
Terry:

Thank you very much, that will work. One further question - I created a table that is updated from a query to make the "file name" and added an autonumber field and then another update q to add the autonumber to the file name so it looks like 1111-06301425-001.txt Can I reference this as the file name in the same way you suggested? That is call the "last record" by the field name as the text file name?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top