Data from combo box

G

Guest

I have a form with a combo box, and I need to use the selection made in the
combo box in a query. ( the combo box have a list of names and I need to
build a query selecting the id of the chosen name)
In the query criteria I wrote :[forms]![form name]![column name]

When I open the query ( after doing my selection in the combo box), a dialog
box jump and ask me to enter the variable.
But the variable I wanted was the one I chose in the combo box……
Why does this window jump? What did I do wrong?

the query code:
SELECT tblOrganisms.TaxID
FROM tblOrganisms
WHERE (((tblOrganisms.Organism)=[Forms]![frmCompare2Lists]![cmbOrganism1]));


Thanks for the help, I’m still new in this :)
Dana.
 
J

John Spencer (MVP)

Basic advice,

First, is the form open when you run the query. It has to be for this to work.
Second, double-check the spelling of the form name and the control.
 
G

Guest

The form is open when I run the query.
I checked the spelling again, it’s correct, and I used the expressions
builder to build the criteria, so it must be correct.
Is there a place where I need to define the connection between the query to
the form?
Thanks,
Dana.


John Spencer (MVP) said:
Basic advice,

First, is the form open when you run the query. It has to be for this to work.
Second, double-check the spelling of the form name and the control.


I have a form with a combo box, and I need to use the selection made in the
combo box in a query. ( the combo box have a list of names and I need to
build a query selecting the id of the chosen name)
In the query criteria I wrote :[forms]![form name]![column name]

When I open the query ( after doing my selection in the combo box), a dialog
box jump and ask me to enter the variable.
But the variable I wanted was the one I chose in the combo boxâ€|â€|
Why does this window jump? What did I do wrong?

the query code:
SELECT tblOrganisms.TaxID
FROM tblOrganisms
WHERE (((tblOrganisms.Organism)=[Forms]![frmCompare2Lists]![cmbOrganism1]));

Thanks for the help, I’m still new in this :)
Dana.
 

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