Guest_imported
New member
- Jan 1, 1970
- 0
Private Sub Command62_Click()
On Error GoTo Err_Command62_Click
Dim stDocName As String
stDocName = "Query3"
DoCmd.OutputTo acReport, stDocName
Exit_Command62_Click:
Exit Sub
Err_Command62_Click:
MsgBox Err.Description
Resume Exit_Command62_Click
End Sub
The above code sends a report relating to Query 3 to excel
but if I modify the code (see below) to try to send the report to a specific file, it sends a report relating to all the data in table not just the query ?
Private Sub Command62_Click()
On Error GoTo Err_Command62_Click
DoCmd.OutputTo acReport, _
"sheet1", acFormatXLS, "E:\test.xls", 0
Exit_Command62_Click:
Exit Sub
Err_Command62_Click:
MsgBox Err.Description
Resume Exit_Command62_Click
End Sub
can anyone tell me where I am oing wrong,
excuse my ignorance but I am a beginner
On Error GoTo Err_Command62_Click
Dim stDocName As String
stDocName = "Query3"
DoCmd.OutputTo acReport, stDocName
Exit_Command62_Click:
Exit Sub
Err_Command62_Click:
MsgBox Err.Description
Resume Exit_Command62_Click
End Sub
The above code sends a report relating to Query 3 to excel
but if I modify the code (see below) to try to send the report to a specific file, it sends a report relating to all the data in table not just the query ?
Private Sub Command62_Click()
On Error GoTo Err_Command62_Click
DoCmd.OutputTo acReport, _
"sheet1", acFormatXLS, "E:\test.xls", 0
Exit_Command62_Click:
Exit Sub
Err_Command62_Click:
MsgBox Err.Description
Resume Exit_Command62_Click
End Sub
can anyone tell me where I am oing wrong,
excuse my ignorance but I am a beginner