N
Nadir
I have this Report that I draged a "Query" in to it. I need to have it
to open by "Response report number" that is in the "Query" and the
Query name is "qryOutsideResponses" and the Query field is
"ResReportNumber"
This code opens the first report. The Report can have one to three -
out side responses - (Police Dept., Fire Dept., and Paramedic)
As long as it will find a match number with the "Response" in that
field it will be fine.
What do I need to do? Please help.
Thank you.
Private Sub PrintByPoliceReport__Click()
On Error GoTo Err_PrintByPoliceReport__Click
------------------------------------------------------------------------------
Dim stDocName As String
Dim intUserRespond As Integer
Dim strResReportNumber As String
Dim strWhere As String
Dim cancel As Integer
If Me.Dirty Then 'save any edits
Me.Dirty = False
Else
strResReportNumber = InputBox("Please enter the Police Report
Number you wish to print", "View BPL by Respond Report Number")
If IsNumeric(strResReportNumber) = False Then
Exit Sub
Else
strResReportNumber = CInt(strResReportNumber)
strWhere = "[ResReportNumber] = """ & strResReportNumber &
""""
stDocName = "rptMasterBPLReport"
DoCmd.OpenReport stDocName, acViewPreview, , strWhere
DoCmd.RunCommand acCmdZoom100
intUserRespond = MsgBox("Do you want to print this report?",
vbOKCancel, "Print Report Window")
If intUserRespond = vbOK Then
cancel = True
DoCmd.OpenReport acPrintAll, acViewPreview
Else
DoCmd.Close
End If
End If
'End If
Exit_PrintByPoliceReport__Click:
Exit Sub
Err_PrintByPoliceReport__Click:
MsgBox Err.Description
Resume Exit_PrintByPoliceReport__Click
End Sub
to open by "Response report number" that is in the "Query" and the
Query name is "qryOutsideResponses" and the Query field is
"ResReportNumber"
This code opens the first report. The Report can have one to three -
out side responses - (Police Dept., Fire Dept., and Paramedic)
As long as it will find a match number with the "Response" in that
field it will be fine.
What do I need to do? Please help.
Thank you.
Private Sub PrintByPoliceReport__Click()
On Error GoTo Err_PrintByPoliceReport__Click
------------------------------------------------------------------------------
Dim stDocName As String
Dim intUserRespond As Integer
Dim strResReportNumber As String
Dim strWhere As String
Dim cancel As Integer
If Me.Dirty Then 'save any edits
Me.Dirty = False
Else
strResReportNumber = InputBox("Please enter the Police Report
Number you wish to print", "View BPL by Respond Report Number")
If IsNumeric(strResReportNumber) = False Then
Exit Sub
Else
strResReportNumber = CInt(strResReportNumber)
strWhere = "[ResReportNumber] = """ & strResReportNumber &
""""
stDocName = "rptMasterBPLReport"
DoCmd.OpenReport stDocName, acViewPreview, , strWhere
DoCmd.RunCommand acCmdZoom100
intUserRespond = MsgBox("Do you want to print this report?",
vbOKCancel, "Print Report Window")
If intUserRespond = vbOK Then
cancel = True
DoCmd.OpenReport acPrintAll, acViewPreview
Else
DoCmd.Close
End If
End If
'End If
Exit_PrintByPoliceReport__Click:
Exit Sub
Err_PrintByPoliceReport__Click:
MsgBox Err.Description
Resume Exit_PrintByPoliceReport__Click
End Sub