Hello eveyrone I have a report name rptDivision and one of the fields is Relationship. I'm trying to figure out how to open the report with criteria for field Relationship = to Life, Auto or Finance by using InputBox where user enter life and report shows the criteria on life or auto, Finace.
Somehow the stWrhere doesn't work.
Private Sub Report_by_Division_Click()
On Error GoTo Err_Report_by_Division_Click
Dim stWhere As String
Dim stDocName As String
Dim Message, Title, MyValue
Message = "Auto, Life"
Title = "Report By Division"
MyValue = InputBox(Message, Title)
stDocName = "rtpDivision"
stWhere = "[Relationship] = " & MyValue
DoCmd.OpenReport stDocName, acPreview, , stWhere
Exit_Report_by_Division_Click:
Exit Sub
Err_Report_by_Division_Click:
MsgBox Err.Description
Resume Exit_Report_by_Division_Click
End Sub
Somehow the stWrhere doesn't work.
Private Sub Report_by_Division_Click()
On Error GoTo Err_Report_by_Division_Click
Dim stWhere As String
Dim stDocName As String
Dim Message, Title, MyValue
Message = "Auto, Life"
Title = "Report By Division"
MyValue = InputBox(Message, Title)
stDocName = "rtpDivision"
stWhere = "[Relationship] = " & MyValue
DoCmd.OpenReport stDocName, acPreview, , stWhere
Exit_Report_by_Division_Click:
Exit Sub
Err_Report_by_Division_Click:
MsgBox Err.Description
Resume Exit_Report_by_Division_Click
End Sub