I actually did try a few options as I mentioned beforeYou supply NOTHING! to the function, so how is Access meant to know where you want to be?
Do you ever try anything yourself to see what works and what does not?
I have just used a file name, no folder path with it, just a filename as the first parameter, and it opens in My Documents folder with the name of the filename I supplied in the parameter?
You still need to decide what to do when no filename is supplied?
And I do not know how what to do to have the fine name automatically populated
I do not know where to point for the File name, that I what I keep on telling you
StrFileName points to public function StrGetFileFolderName, I assume I dont need to make any rectification in this module as I use this funtion for multiple other save as reports
So I my File Name must be specified in the exportSparesforOrders funtion and I dont know how to perform this as when I cancel, I still receive the File Name argument error
Private Sub ExcelSparesforOrders__ExcelSparesforOrders_Click()
Dim StrFileName As String
Dim StrQryName As String
Dim StrSaveFile As String
StrFileName = strGetFileFolderName("Spares for Orders", 2, "Excel")
Debug.Print StrFileName
StrQryName = "CS Orders - Spares for Orders QRY"
'DoCmd.TransferSpreadsheet acExport, 10, StrQryName, StrSaveFile, True, , True
DoCmd.TransferSpreadsheet acExport, 10, StrQryName, StrFileName, True, , True
'DoCmd.TransferSpreadsheet acExport, 10, "CS Orders - Spares for Orders QRY", "C:\Users\e498309\Test.xls", True, StrFileName, True
'DoCmd.TransferSpreadsheet acExport, 10, qryName, strSaveFile, True, , True
End Sub
Last edited: