A
allie357
I have a form that allows the user to run a variety of reports by using
a check box to select which to run.
The report runs but then I am unable to click on the print preview to
zoom in or click on it at all until I close the form. I need the form
to stay open. Any help is appreciated.
Code:
--------------------------------------------------------------------------------
Private Sub RunReport_Click()
On Error GoTo Err_Handler
Dim strRCName As String
Dim strDeptName As String
Dim strDate As String
Dim strWhere As String
Dim strWhereNumDate As String
strWhereNumDate = "DateEntered = Between
[Forms]![SummaryReportFilter1]![txtStartDate] And
[Forms]![SummaryReportFilter1]![txtEndDate]"
' Build criteria string for RCName field
If IsNull(Me.CboRCName.Value) Then
strRCName = "Like '*'"
Else
strRCName = "='" & Me.CboRCName.Value & "'"
End If
' Build criteria string for DeptName field
If IsNull(Me.cboDeptName.Value) Then
strDeptName = "Like '*'"
Else
strDeptName = "='" & Me.cboDeptName.Value & "'"
End If
' Build the WHERE clause.
strDate = "[DateEntered] Between #" & Me!txtStartDate & _
"# And #" & Me!txtEndDate & "#"
Err_Handler:
If Err.Number = 2501 Then
' ignore "action cancelled" error
Exit Sub
End If
' Combine criteria strings into a WHERE clause for the filter
strWhere = "[RCName] " & strRCName & " AND [DeptName] " &
strDeptName & " AND " & strDate
' Build criteria string for Report Type
Select Case Me.FraReport.Value
Case 1
DoCmd.OpenReport "rpt_Violations by Department", _
acViewPreview, , strWhere
Case 2
DoCmd.OpenReport "rpt_Violations_by_Type", _
acViewPreview, , strWhere
Case 3
DoCmd.OpenReport "rpt_Violations_by_Violator", _
acViewPreview, , strWhere
Case 4
DoCmd.OpenReport "rpt_Violations_by_Violator_by Number of
Times", _
acViewPreview, strWhere
End Select
End Sub
a check box to select which to run.
The report runs but then I am unable to click on the print preview to
zoom in or click on it at all until I close the form. I need the form
to stay open. Any help is appreciated.
Code:
--------------------------------------------------------------------------------
Private Sub RunReport_Click()
On Error GoTo Err_Handler
Dim strRCName As String
Dim strDeptName As String
Dim strDate As String
Dim strWhere As String
Dim strWhereNumDate As String
strWhereNumDate = "DateEntered = Between
[Forms]![SummaryReportFilter1]![txtStartDate] And
[Forms]![SummaryReportFilter1]![txtEndDate]"
' Build criteria string for RCName field
If IsNull(Me.CboRCName.Value) Then
strRCName = "Like '*'"
Else
strRCName = "='" & Me.CboRCName.Value & "'"
End If
' Build criteria string for DeptName field
If IsNull(Me.cboDeptName.Value) Then
strDeptName = "Like '*'"
Else
strDeptName = "='" & Me.cboDeptName.Value & "'"
End If
' Build the WHERE clause.
strDate = "[DateEntered] Between #" & Me!txtStartDate & _
"# And #" & Me!txtEndDate & "#"
Err_Handler:
If Err.Number = 2501 Then
' ignore "action cancelled" error
Exit Sub
End If
' Combine criteria strings into a WHERE clause for the filter
strWhere = "[RCName] " & strRCName & " AND [DeptName] " &
strDeptName & " AND " & strDate
' Build criteria string for Report Type
Select Case Me.FraReport.Value
Case 1
DoCmd.OpenReport "rpt_Violations by Department", _
acViewPreview, , strWhere
Case 2
DoCmd.OpenReport "rpt_Violations_by_Type", _
acViewPreview, , strWhere
Case 3
DoCmd.OpenReport "rpt_Violations_by_Violator", _
acViewPreview, , strWhere
Case 4
DoCmd.OpenReport "rpt_Violations_by_Violator_by Number of
Times", _
acViewPreview, strWhere
End Select
End Sub