All, using access 2016...I have a report based on a query I need users to export to a folder on the desktop.The button is on the form. It runs but just places the field names in the columns with no data. Also On the left side there's the numbers 123 like its tring to group something.
Here is the code I'm using:
If this isn't possible, please show me how to export the query based on the forms filter instead. Thank you
Here is the code I'm using:
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\Reports\"
theFilePath = theFilePath & reportname & "_" & Format(Date, "yyyy-mm-dd") & ".xls"
DoCmd.OutputTo acOutputReport, reportname, acFormatXLS, 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