Export to Excel with Automatic Date Name

D

Dan Galloway

I have Access 97 building a data table that must be
exported daily as an Excel file to another user. How can
I get Access to automatically name the output .xls file
with today's date, i.e. 071403 or 07-14-03. Ideally, I'd
like to have it use a fixed text name with variable
date: ABC 07-14-03 for example, since I actually output
two .xls spreadsheets, one named ABC (date) and the other
XYZ (date).
 
J

Joe Fallon

You can import and export using code like this (change to acExport).

That means you can compute a string for the file name based on Today's date
and use it in your code.

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, strTableName,
strLocalDir & strLocalFileName, True
 
T

Terence

You can tweak and use the below line of code. You would
want to use "Now()" in your filename to get the current
date. ex. Lawmanagerdata & Now() & .txt

DoCmd.TransferText acExportFixed, "New LawManagerData
Export", "Lawmanagerdata", "\\sdxhq-fc1
\HRISLM\Lawmanagerdata.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