Combo Box in Query

S

Skymgr

Hi,
I was wondering if it's possible to have a combo box pop
up to select a name from the list to run the query for?
I am working with Access2000 and have a query that when
executed, it will ask the user to enter the Analyst
Initials. Then it runs an activity report for that
analyst. I would like a list or combo box pop up that the
user can select from. This would make it easier to
identify the analyst that you want to run the query for.

Thanks,
Skymgr
 
S

Steven M. Britton

What you can do is make a form to look like a dialog box,
on the form make your combo box that you are refering to.
Then have the button that runs the query first open the
dialog box, then minimize it or move it to the
background. Then have your query critera reference that
forms combo boxes value.

forms!frmAnalystDialog.comboBoxwiththeinitals

-Steve
 
S

Skymgr

Thanks Steve! I'll try it.
Skymgr
-----Original Message-----
What you can do is make a form to look like a dialog box,
on the form make your combo box that you are refering to.
Then have the button that runs the query first open the
dialog box, then minimize it or move it to the
background. Then have your query critera reference that
forms combo boxes value.

forms!frmAnalystDialog.comboBoxwiththeinitals

-Steve

.
 
B

Bruce M. Thompson

In addition to Steve's suggestion, you can also place your combo box right on
the form from which you are calling the query and reference that combo box in
the query's criteria.
 
S

Skymgr

Steve,
I tried the following:
Created a form "frmAnalystDialog"
record source set as T_Analyst (Table contains the names &
initials)
Created Combo Box on form named "Price Analyst Selection"
Control Source: Analyst (Field in table with Analyst names)
Row Source Type: Table/Query
Row Source: SELECT T_Analyst.Analyst, T_Analyst.Initials
FROM T_Analyst;
In Q_ActiveAnalyst Query
Replaced [Enter Analyst Initials] with
Forms!frmAnalystDialog.comboboxpriceanalystselection

When I run the query I get a pop-up "Enter Parameter
Value": Forms!
frmAnalystDialog.comboboxpriceanalystselection

Can you tell me what I am doing wrong or not doing to make
it work?
Appreciate your help.
Skymgr
 
S

Skymgr

Bruce,
I have this report coming from a reports menu and the
event procedure definition is as follows:

Private Sub Button12_Click()
' Open the Analyst Activity Report
DoCmd.OpenReport "R_Analyst Activity",
acViewPreview, "Q_ActiveAnalyst"
End Sub

Are you saying to have the combo box form listed
before "Q_ActiveAnalyst" or in place of?

Thanks,
Frank
 
J

John Vinson

Can you tell me what I am doing wrong or not doing to make
it work?

The form must be open FIRST.

I'd suggest putting a command button on the Form to open the query; or
- much better - to open a Form (for onscreen display) or a Report (for
printing), based on the query.
 
B

Bruce M. Thompson

I have this report coming from a reports menu and the
event procedure definition is as follows:

Private Sub Button12_Click()
' Open the Analyst Activity Report
DoCmd.OpenReport "R_Analyst Activity",
acViewPreview, "Q_ActiveAnalyst"
End Sub

Are you saying to have the combo box form listed
before "Q_ActiveAnalyst" or in place of?

It appears that you are using a query named "Q_ActiveAnalyst" as a filter for
the report, so you could simply replace the criteria in that query that you're
using as the filter to look at the combo box on your form instead of prompting
you for that value, and that appears to be what you have done from what you
described in your response to Steve. In this case, however, your form is
guaranteed to be already open, as pointed out to be necessary in John Vinson's
reply to your post.
 

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