How can I output a table to Excel using a date on a form as part of the filename?

MobiusDick

Hippy Materialist
Local time
Today, 19:54
Joined
Aug 23, 2007
Messages
23
Sorry about the duplication- have had some weird Network issues, and I thought it hadn't posted.
 
It's actually pretty simple, you first assemble a String variable form the various fields in your form and other Strings, then use that variable in the Export function. The CStr() function is built-in in Access and converts almost anything to a String.

Code:
Dim ee_filename as String
ee_filename = "Access-Export from "+ CStr(Form_Sample.Datefield) + CStr(Form_Sample.Excel_export_name) + CStr(Form_Anotherformaltogether.Excel_export_extension)
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "Sample_Table_to_Export", ee_filename, , "Sample_Sheet"

Hope this helped!
Bani
 

Users who are viewing this thread

Back
Top Bottom