RagonichaFulva
Programmer
Hello,
I am trying to make a code that makes a query, exports it to a new excel file and then makes another query and adds the results in a new worksheet.
I am beginning my code the following way:
Unfortunately, MS Access sends a 3011 Run-time error says that it can't find the object "querystorestest", but the query is in the database...
I would much appreciate your assistance.
I am trying to make a code that makes a query, exports it to a new excel file and then makes another query and adds the results in a new worksheet.
I am beginning my code the following way:
Code:
Sub EXCEL_TEST()
Dim ExcelPath As String
Dim ExcelSheet As Object
Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelPath = "\\MATEUC4\GCSS_RPS_Mirror_Tool_PRODUCTION\Reports\RPS_Cases_Monthly_Report_" & Format(Now() - 1, "yyyymm-mmmyyyy") & ".xlsx"
Debug.Print ExcelPath
ExcelSheet.Application.Visible = True
ExcelSheet.SaveAs ExcelPath
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "querystorestest", ExcelPath
ExcelSheet.Application.Quit
Set ExcelSheet = Nothing
End Sub
Unfortunately, MS Access sends a 3011 Run-time error says that it can't find the object "querystorestest", but the query is in the database...
I would much appreciate your assistance.