Selecting from a list for Query criteria

  • Thread starter Thread starter Mike G
  • Start date Start date
M

Mike G

How do I set up a query with criteria that a user can
select from?
I have a table containing projects, when the user runs
the query, I want to give them the ability to select a
project(s) from the list, and then what was selected be
used as the criteria.
Thanks
Mike
 
Hi Mike,

I think what would work best for you would be to have the
user open a form. On the form would be an unbound combo
box that would list the projects.

Then, you could use a button, or the afterupdate event of
the combo, to open the query, and the query would use the
value of the combo box as the criteria. To do this,
enter:

[Forms]![frmName]![cboName]

in the criteria field of the query. But, replace frmName
with the name of the form and cboName with the name of
the Combo Box.

Make sure that the value being stored (not necessarily
the same as what is displayed) in the combo matches the
field that it is being compared to. In other words,
don't store the ProjectID in the combo and compare use it
for the criteria for project name, or vice-versa.
Compare ProjectID to ProjectID or Project Name to Project
Name.

Hope that Helps.

-Ted Allen
 
Back
Top