This question picks up where this one left off.
I have a form, FISReports, this form calls a report, RISIF. RISIF uses a query, QISIFReport, as its record source.
On FISReports, there are 3 pieces of criteria:
1. To and From dates (to unbound boxes)
2. BA (unbound combo box, this is a list of employees)
3. Status (unbound combo box, a list of status's to choose from)
On the thread that's linked above, David R helped me get this to work where the To/From dates are in the query, QISIFReport, and the BA is part of the "event procedure". Basically if BA is unpopulated, then it picks all.
... OK, now the question. I want to add the Status to this and have it function like BA. If its blank you get all statuses, otherwise you just get what you selected.
Here's the code before I try this:
----------------
Private Sub RunReport_Click()
On Error GoTo Err_RunReport_Click
Dim stDocName As String, stDocWhere As String
stDocName = "RISIF"
If Not IsNull(Forms![FSISReports].BA) Then
stDocWhere = "[BA] = '" & Me.BA & "'"
End If
DoCmd.OpenReport stDocName, acPreview, , stDocWhere
Exit_RunReport_Click:
Exit Sub
Err_RunReport_Click:
MsgBox Err.Description
Resume Exit_RunReport_Click
End Sub
------
What I don't know is the syntax to add my "status" criteria. I would assume I model it on the "BA" criteria, but do I do it as a separate "IF" statement or w/ an "AND" statement?
OK, that's my question.
I have a form, FISReports, this form calls a report, RISIF. RISIF uses a query, QISIFReport, as its record source.
On FISReports, there are 3 pieces of criteria:
1. To and From dates (to unbound boxes)
2. BA (unbound combo box, this is a list of employees)
3. Status (unbound combo box, a list of status's to choose from)
On the thread that's linked above, David R helped me get this to work where the To/From dates are in the query, QISIFReport, and the BA is part of the "event procedure". Basically if BA is unpopulated, then it picks all.
... OK, now the question. I want to add the Status to this and have it function like BA. If its blank you get all statuses, otherwise you just get what you selected.
Here's the code before I try this:
----------------
Private Sub RunReport_Click()
On Error GoTo Err_RunReport_Click
Dim stDocName As String, stDocWhere As String
stDocName = "RISIF"
If Not IsNull(Forms![FSISReports].BA) Then
stDocWhere = "[BA] = '" & Me.BA & "'"
End If
DoCmd.OpenReport stDocName, acPreview, , stDocWhere
Exit_RunReport_Click:
Exit Sub
Err_RunReport_Click:
MsgBox Err.Description
Resume Exit_RunReport_Click
End Sub
------
What I don't know is the syntax to add my "status" criteria. I would assume I model it on the "BA" criteria, but do I do it as a separate "IF" statement or w/ an "AND" statement?
OK, that's my question.
Last edited: