Option buttons to pass parameter to view report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form where I have set up a tab control with 2 tabs and with 3 option buttons on each. One of the tab sets the name of my report and I do an if statement and the appropriate report runs. My problem is I use a select case for the parameter values which I store to strFilter. For some reason strFilter is not seen as containing the parameter and I am prompted for the parameter value.
My option group on the form is called EEType
StrReportName is set based on the selection on tab 2
then I have the following code for my parameter value

Dim strFilter as string
Select Case EEType
Case 1
strFilter = "eeDept = sales"
Case 2
strFilter = "eeDept = admin"
End Select
DoCmd.OpenReport strReportName, acViewPreview, , strFilter

My problem is that the appropriate report opens but I am then prompted for a parameter value. For some reason strFilter is not seen as setting the paramete. What am I missing here!!!!
Thanks for your help!
 
Macy said:
I have a form where I have set up a tab control with 2 tabs and with 3 option buttons on each. One of the tab sets the name of my report and I do an if statement and the appropriate report runs. My problem is I use a select case for the parameter values which I store to strFilter. For some reason strFilter is not seen as containing the parameter and I am prompted for the parameter value.
My option group on the form is called EEType
StrReportName is set based on the selection on tab 2
then I have the following code for my parameter value

Dim strFilter as string
Select Case EEType
Case 1
strFilter = "eeDept = sales"
Case 2
strFilter = "eeDept = admin"
End Select
DoCmd.OpenReport strReportName, acViewPreview, , strFilter

My problem is that the appropriate report opens but I am then prompted for a parameter value. For some reason strFilter is not seen as setting the paramete. What am I missing here!!!!


Since sales and admin are text, they mist be enclosed in
quotes:

use either
strFilter = "eeDept = ""sales"""
or
strFilter = "eeDept = 'admin'"
 
Back
Top