How do I open a report filtered from an option group?
I have a report, rptEveryone, based on a query, qryEveryone. One field in the query and on the report is called DoctorName.
I have an option group, optSelectReport, on a main form, frmMain. The option group has 3 options. When the user
selects the 3rd option (labeled "Preview Report for Doctors only"
and hits a command button, cmdPreview, I'd like rptEveryone to open filtered for records where the DoctorName is not null. Right now the report opens unfiltered, because I don't know how to write what I assume should be a Where statement (like "Where DoctorName Is Not Null).
Here's what I have so far in the code of frmMain:
**************************************
Sub PrintReports(PrintMode As Integer)
On Error GoTo Err_Preview_Click
' This procedure used in Preview_Click sub procedure.
Select Case Me!optSelectReport
Case 3
DoCmd.OpenReport "rptEveryone", PrintMode
End Select
Exit_Preview_Click:
Exit Sub
Err_Preview_Click:
Resume Exit_Preview_Click
End Sub
----------------------------------
Private Sub cmdPreview_Click()
PrintReports acPreview
End Sub
**************************************
Thank you for any help.
Hoving
I have a report, rptEveryone, based on a query, qryEveryone. One field in the query and on the report is called DoctorName.
I have an option group, optSelectReport, on a main form, frmMain. The option group has 3 options. When the user
selects the 3rd option (labeled "Preview Report for Doctors only"
Here's what I have so far in the code of frmMain:
**************************************
Sub PrintReports(PrintMode As Integer)
On Error GoTo Err_Preview_Click
' This procedure used in Preview_Click sub procedure.
Select Case Me!optSelectReport
Case 3
DoCmd.OpenReport "rptEveryone", PrintMode
End Select
Exit_Preview_Click:
Exit Sub
Err_Preview_Click:
Resume Exit_Preview_Click
End Sub
----------------------------------
Private Sub cmdPreview_Click()
PrintReports acPreview
End Sub
**************************************
Thank you for any help.
Hoving