Combo Box in a Query

B

Bill

First of all I have searched and found out how to do this. At least in
theory I found out. I want to search a table and have the query find all the
records with a certain chemical name.

As these names can be long and complicated I want to use a Combo Box so that
the user can SELECT a chemical name to search. I created a FORM with a Combo
Box that will display the chemical names that are used in the table. That
form works. If I run it I get a Combo Box which displays the Chemical Names.
That FORM is called "frmChemicalNameList" The Combo Box on the FORM is
"cboChemName".

I created a QUERY to display all the records for the Chemical based on the
Combo Box selection. In the CRITERIA area, under the FIELD for ChemicalName,
I typed -

=[Forms]![frmChemicalNameList]![cboChemName]

When I RUN the QUERY I get a box that says Enter Parameter Value and
Forms!frmChemicalNameList!cboChemName not the Combo Box.

Any ideas?

Thanks,

Bill
 
E

Ed B

Hi Bill,

If I understand you correctly, what you did _should_ work. A couple of
things to check:

1. Make sure the form is open and that a valid ChemicalName is selected
before you try to run the query.

2. Is it possible you mistyped the Criteria? An easy way to double-check:

a. Open the Form and pick a chemical.

b. Open the Query in design view.

c. Delete (or Ctrl-X if you want so you can repaste with Ctrl-V if
necessary) the ChemicalName criteria.

d. Click in the Criteria box under ChemicalName, then right-click and select
Build...

e. In the left pane: double-click the '+' next to Forms then double-click
the '+' next to Loaded Forms

f. Select frmChemicalNameList

g. in the middle pane, select cboChemName

h. Click OK.

The criteria should read "[Forms]![frmChemicalNameList]![cboChemName]" but
might be a little different if there was a minor typo somewhere. [Note that
the new criteria doesn't start with the '=' you had; it doesn't
matter--'equals is the default, so there's no difference either way]

I'm not sure what's going on...Try as I might I can't get the "Enter
Parameter Value" box to come up...

Good luck,

Ed
 
B

Bill

Ed B

Sorry I was away for the Thanksgiving Holiday. I used the Build so no
typos. I think I misunderstood what to do. I have a newer post that
explains more fully.

Thanks for the reply


Ed B said:
Hi Bill,

If I understand you correctly, what you did _should_ work. A couple of
things to check:

1. Make sure the form is open and that a valid ChemicalName is selected
before you try to run the query.

2. Is it possible you mistyped the Criteria? An easy way to double-check:

a. Open the Form and pick a chemical.

b. Open the Query in design view.

c. Delete (or Ctrl-X if you want so you can repaste with Ctrl-V if
necessary) the ChemicalName criteria.

d. Click in the Criteria box under ChemicalName, then right-click and select
Build...

e. In the left pane: double-click the '+' next to Forms then double-click
the '+' next to Loaded Forms

f. Select frmChemicalNameList

g. in the middle pane, select cboChemName

h. Click OK.

The criteria should read "[Forms]![frmChemicalNameList]![cboChemName]" but
might be a little different if there was a minor typo somewhere. [Note that
the new criteria doesn't start with the '=' you had; it doesn't
matter--'equals is the default, so there's no difference either way]

I'm not sure what's going on...Try as I might I can't get the "Enter
Parameter Value" box to come up...

Good luck,

Ed


Bill said:
First of all I have searched and found out how to do this. At least in
theory I found out. I want to search a table and have the query find all the
records with a certain chemical name.

As these names can be long and complicated I want to use a Combo Box so that
the user can SELECT a chemical name to search. I created a FORM with a Combo
Box that will display the chemical names that are used in the table. That
form works. If I run it I get a Combo Box which displays the Chemical Names.
That FORM is called "frmChemicalNameList" The Combo Box on the FORM is
"cboChemName".

I created a QUERY to display all the records for the Chemical based on the
Combo Box selection. In the CRITERIA area, under the FIELD for ChemicalName,
I typed -

=[Forms]![frmChemicalNameList]![cboChemName]

When I RUN the QUERY I get a box that says Enter Parameter Value and
Forms!frmChemicalNameList!cboChemName not the Combo Box.

Any ideas?

Thanks,

Bill
 

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