K
Kurt
When a user selects the 3rd option in an option group (of
various reports), a combo box appears (cboRespondant).
The user can then select either a) a patient id or
b) "(All)" and then click a button to preview, print, or
email a report for that patient or patients.
My problem is that if the user selects "(All)" and then
goes to preview or print the report, the report opens but
with no data. (If the combo box is empty, everything
works - but I like the use of an "(All)" option if I can
get it to work.)
The report print/preview feature is part of a Select Case
function. How can I edit this (or the combo box Row
Source, Report, etc.) so that the ("All") option works?
Thanks. - Kurt (code below)
The Row Source for the combo box is:
----------------------------------------------
SELECT DISTINCTROW tblSrvRspns.RspnsID
FROM tblSrvRspns
UNION SELECT "(All)"
From tblSrvRspns
ORDER BY tblSrvRspns.RspnsID;
The report has this Filter:
------------------------------
(RspnsID = Forms![frmnuReportSelect]!cboRespondant).
The option group uses a Select Case function:
------------------------------------------------------
Sub PrintReports(PrintMode As Integer)
On Error GoTo Err_Preview_Click
' This procedure used in Preview_Click and
' Print_Click Sub procedures.
' Preview or print report selected in the option group.
Dim strWhereRspnsID As String
strWhereRspnsID = "RspnsID = Forms![frmnuReportSelect]!
cboRespondant"
Select Case Me!optSelectReport
Case 1
Me![cboRespondant].Visible = False
DoCmd.OpenReport "rptStatistics", PrintMode
Case 2
Me![cboRespondant].Visible = False
DoCmd.OpenReport "rptStatisticsWithGraphs", PrintMode
Case 3
Me![cboRespondant].Visible = True
If IsNull(Forms![frmnuReportSelect]!cboRespondant)
Then
DoCmd.OpenReport "rptIndividualSurvey", PrintMode
Else
DoCmd.OpenReport "rptIndividualSurvey", PrintMode,
, strWhereRspnsID
End If
End Select
Exit_Preview_Click:
Exit Sub
Err_Preview_Click:
Resume Exit_Preview_Click
End Sub
various reports), a combo box appears (cboRespondant).
The user can then select either a) a patient id or
b) "(All)" and then click a button to preview, print, or
email a report for that patient or patients.
My problem is that if the user selects "(All)" and then
goes to preview or print the report, the report opens but
with no data. (If the combo box is empty, everything
works - but I like the use of an "(All)" option if I can
get it to work.)
The report print/preview feature is part of a Select Case
function. How can I edit this (or the combo box Row
Source, Report, etc.) so that the ("All") option works?
Thanks. - Kurt (code below)
The Row Source for the combo box is:
----------------------------------------------
SELECT DISTINCTROW tblSrvRspns.RspnsID
FROM tblSrvRspns
UNION SELECT "(All)"
From tblSrvRspns
ORDER BY tblSrvRspns.RspnsID;
The report has this Filter:
------------------------------
(RspnsID = Forms![frmnuReportSelect]!cboRespondant).
The option group uses a Select Case function:
------------------------------------------------------
Sub PrintReports(PrintMode As Integer)
On Error GoTo Err_Preview_Click
' This procedure used in Preview_Click and
' Print_Click Sub procedures.
' Preview or print report selected in the option group.
Dim strWhereRspnsID As String
strWhereRspnsID = "RspnsID = Forms![frmnuReportSelect]!
cboRespondant"
Select Case Me!optSelectReport
Case 1
Me![cboRespondant].Visible = False
DoCmd.OpenReport "rptStatistics", PrintMode
Case 2
Me![cboRespondant].Visible = False
DoCmd.OpenReport "rptStatisticsWithGraphs", PrintMode
Case 3
Me![cboRespondant].Visible = True
If IsNull(Forms![frmnuReportSelect]!cboRespondant)
Then
DoCmd.OpenReport "rptIndividualSurvey", PrintMode
Else
DoCmd.OpenReport "rptIndividualSurvey", PrintMode,
, strWhereRspnsID
End If
End Select
Exit_Preview_Click:
Exit Sub
Err_Preview_Click:
Resume Exit_Preview_Click
End Sub