G
Gerald Stanley
Try DoCmd.OpenReport without the first comma - the first
parameter should be the report name.
Hope That Helps
Gerald Stanley MCSD
wanted to run a different report each time a selection was
made. One of the suggestions was to create a command button
and write code behind it for the selection of the combo
"Argument not optional"
parameter should be the report name.
Hope That Helps
Gerald Stanley MCSD
to click on a selection in a combo box and run a report. I-----Original Message-----
This was from yesterday where I had problems with trying
wanted to run a different report each time a selection was
made. One of the suggestions was to create a command button
and write code behind it for the selection of the combo
and I get an error with both that says: Compile error:box. Here is what I said:Okay, now this is the code I've put in (2 different ways)
"Argument not optional"
1st way tried:
Private Sub cmdrunreport_Click()
On Error GoTo Err_cmdrunreport_Click
Dim stDocName As String
Select Case [cboSelectReport]
Case "MA1"
stDocName = "MA1 All"
Case "MA2"
stDocName = "MA2 All"
Case "MA3"
stDocName = "MA3 All"
End Select
DoCmd.OpenReport , stDocName, acViewPreview
Exit_cmdrunreport_Click:
Exit Sub
Err_cmdrunreport_Click:
MsgBox Err.Description
Resume Exit_cmdrunreport_Click
End Sub
-------
2nd way tried:
Private Sub cmdrunreport_Click()
On Error GoTo Err_cmdrunreport_Click
Dim stDocName As String
Select Case [cboSelectReport]
Case "MA1"
stDocName = "MA1 All"
DoCmd.OpenReport , stDocName, acViewPreview
Case "MA2"
stDocName = "MA2 All"
DoCmd.OpenReport , stDocName, acViewPreview
Case "MA3"
stDocName = "MA3 All"
DoCmd.OpenReport , stDocName, acViewPreview
End Select
Exit_cmdrunreport_Click:
Exit Sub
Err_cmdrunreport_Click:
MsgBox Err.Description
Resume Exit_cmdrunreport_Click
End Sub
Print | Copy URL of this post
Expand All Collapse All
Contact Us | Rules of Conduct
.