Variable in DoCmdTransferSpreadsheet

Keith

Registered User.
Local time
Today, 20:41
Joined
May 21, 2000
Messages
129
I have a function to transfer query results to a spreadsheet.

Code:
    DoCmd.TransferSpreadsheet acExport, , "qrySelUpdatesCurrent", _
        "C:\Users\Submariners\Documents\WeeklyFullUpdates.xls", True, "Current"
    DoCmd.TransferSpreadsheet acExport, , "qrySelUpdatesLapsed", _
        "C:\Users\Submariners\Documents\WeeklyFullUpdates.xls", True, "Lapsed"
    DoCmd.TransferSpreadsheet acExport, , "qrySelUpdatesDeceased", _
        "C:\Users\Submariners\Documents\WeeklyFullUpdates.xls", True, "Deceased"

I would like the file name to include the date it was created. I have a function MakeFileName() that returns a file name including the current date i.e. 20121007-Update.xls

I would like to replace WeeklyFullUpdates.xls with 20121007-Update.xls but i'm falling foul of single v double quotes I think. Any guidance would be appreciated.
 
I worked it out in the end. i was a bit hasty in posting.

DoCmd.TransferSpreadsheet acExport, , "qrySelUpdatesLapsed", _
"C:\Users\Submariners\Documents\" & MakeFileName & ".xls", True, "Lapsed"
 

Users who are viewing this thread

Back
Top Bottom