Option buttons to pass parameter to view report

M

Macy

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!
 
M

Marshall Barton

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'"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top