Hi All. I am using access 2010 but working on a 2003 db. I have a command button on a form that I am trying to get to export a report to my desktop:
Code:
Private Sub Export_QA_Report_Click()
On Error GoTo Err_Export_QA_Report_Click
Dim reportname As String
Dim theFilePath As String
reportname = "rptQAReport"
theFilePath = "C:\Documents and Settings\" & Environ("UserName") & "\Desktop\"
theFilePath = theFilePath & reportname & "_" & Format(Date, "yyyy-mm-dd") & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, reportname, theFilePath, True
MsgBox "Look on your desktop for the report."
Exit_Export_QA_Report_Click:
Exit Sub
Err_Export_QA_Report_Click:
MsgBox Err.Description
Resume Exit_Export_QA_Report_Click
End Sub
I am getting a msg stating MS access could not find the object rptQAReport...
This is the correct name of the report I am trying to reference. Can anyone tell me please what's wrong?
Thanks