|
-
Export a report into excel
I need help with some VBA code please.
I have a report that needs to be exported into excel.
I can export it manually, file->export and it exports it fine.
What I want to do is export it when the user clicks on a button.
I have created a form with a button "Export".
Here is the code for the button:
Private Sub cmdExport_Click()
Dim stDocName As String
stDocName = "rptClientReport"
'This code does not work
DoCmd.OutputTo acOutputReport, stDocName, acFormatXLS, "c:\Reports\ClientReport.xls"
End Sub
When I click the "Export" button,
I get error " Run time error: 9.
Subscript out of range"
Why cant I export the report automatically, but I can do it manually.
please help
I have already googled the (*^#$(@ out of this error
and still dont have a fix!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|