Hi all, I am using access 2003. I put a command button on a form so users can run a query and save and open in excel. When I click the button; the query sheet opens; the dialog opens to save the form but I get an error: "microsoft office access can't find the name "I" you entered in the expression" and the spreadsheet does not save or open. Heres my code:
I don't want a report because the query has too many fields and the user prefers an excel spreadsheet.
Also, is there any way to change the fields headings once it outputs to excel. Just a thought for the end user.
I appreciate any help.
Thanks
Code:
Private Sub Command9_Click()
On Error GoTo Err_Command9_Click
Dim stDocName As String
stDocName = "qryMyReport"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.OutputTo acOutputTable, "qryMyReport", acFormatXLS
Exit_Command9_Click:
Exit Sub
Err_Command9_Click:
MsgBox Err.Description
Resume Exit_Command9_Click
End Sub
I don't want a report because the query has too many fields and the user prefers an excel spreadsheet.
Also, is there any way to change the fields headings once it outputs to excel. Just a thought for the end user.
I appreciate any help.
Thanks