I'm going back to an "old" database that was designed a while ago and trying to streamline it.
There are 3 inventory reports that include the dept code for each inventory item [respdept].
There are 4 queries (for each report!!) that I have done to accomplish different filtering methods. I would like to streamline and have one query for each report and pass the filter through the OpenReport method which is run by a button on the form.
For instance:
all - prints all items - parameter blank
Casino - [respdept] between "1" and "200"
Tribal - [respdept] >199
Specific - (respdept would be chosen from a listbox)
I want the user to be able to choose "All", "Tribal", or "casino" and pass the applicable filter parameters.
I've tried doing it and am not having luck.
Here's the code that chooses the different report where I've added the condition text:
------------------------------------
Select Case optInvRange
Case 1
stDocName = strRptName & "ALL"
stCondition = ""
Case 2
stDocName = strRptName & "CASINO"
stCondition = "Between '1' and '200'"
Case 3
stDocName = strRptName & "TRIBAL"
stCondition = ">199"
Case 4
stDocName = strRptName & "SPECIFIC"
cboGC.SetFocus
If cboGC.Text = "" Then
MsgBox "Please Select a group code or another range", vbExclamation, "No Group Code Selected!"
Exit Sub
Else
stCondition = cboGC.Text
End If
--------------------------------------------
And here's where I've attempted to pull the parameters:
DoCmd.OpenReport stDocName, acPreview, [RespDept] = stCondition
--------------------------------
Can someone point me in the right direction?
There are 3 inventory reports that include the dept code for each inventory item [respdept].
There are 4 queries (for each report!!) that I have done to accomplish different filtering methods. I would like to streamline and have one query for each report and pass the filter through the OpenReport method which is run by a button on the form.
For instance:
all - prints all items - parameter blank
Casino - [respdept] between "1" and "200"
Tribal - [respdept] >199
Specific - (respdept would be chosen from a listbox)
I want the user to be able to choose "All", "Tribal", or "casino" and pass the applicable filter parameters.
I've tried doing it and am not having luck.
Here's the code that chooses the different report where I've added the condition text:
------------------------------------
Select Case optInvRange
Case 1
stDocName = strRptName & "ALL"
stCondition = ""
Case 2
stDocName = strRptName & "CASINO"
stCondition = "Between '1' and '200'"
Case 3
stDocName = strRptName & "TRIBAL"
stCondition = ">199"
Case 4
stDocName = strRptName & "SPECIFIC"
cboGC.SetFocus
If cboGC.Text = "" Then
MsgBox "Please Select a group code or another range", vbExclamation, "No Group Code Selected!"
Exit Sub
Else
stCondition = cboGC.Text
End If
--------------------------------------------
And here's where I've attempted to pull the parameters:
DoCmd.OpenReport stDocName, acPreview, [RespDept] = stCondition
--------------------------------
Can someone point me in the right direction?