Hello,
I was wondering if it's possible to export a query without saving it as an object in the front-end. Write out the query in the module and export it? Here below is my code: Let me know is something is wrong. Thanks
Public Sub Test()
Dim Str As String
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogSaveAs)
Str = "SELECT Hello.test FROM Table;"
With fd
.AllowMultiSelect = False
.Title = "Save File"
.InitialFileName = "Str.xlsx"
If .Show = True Then
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Str", .SelectedItems(1)
Else
MsgBox "No File was selected"
End If
End With
Set fd = Nothing
End Sub