Simple query from simple combo box.

G

GS@UM

**Please note: I am a novice at Access.**

I have included a combo box in my table which lists keywords that pertain to
each record in my table. There are only about 10 keywords. I would like to
set up a parameter whereby the user is prompted to select one of the keywords
from a drop-down menu. I have already created another table which contains
the keywords. What must I do to have the user prompted to select from a
provided drop down menu?

Any assistance is greatly appreciated.
 
R

Rick B

You can't. Not in a query, combo-boxes are part of forms, not queries.

If you want, you could build a new unboound form with a combobox that
includes all of the items. Have the user open that form, make a selection,
then click a button on the form. You'd have to code that button to run your
query. In your query, you'd have to replace the current criteria so the
query would look at the form.

For example, your query might have the following...

Like "*"& [Enter Word To Search] & "*"

This allows the user to type a word and it will find it anywhere in the
field.

You'd have to change it to...


Like "*" & Forms![MySearchFormName]![MySearchFieldName] & "*"


Many of the reports that come with the sample database "Northwind" include
this type of query. You can look at them for a sample.
 
J

Jeff Boyce

If you have used a "lookup" datatype in your table ("I have included a combo
box in my table), you will (painfully) learn that what Access stores in that
field, and what it displays in that field, are NOT the same. This means
creating a query against the field, you'd need to know/look for what was
actually stored, not the "display" value that you see. Confused yet?!

In addition to Rick's suggestion, consider changing the datatype of the
lookup field to whatever data type is consistent with the underlying key
value stored.

Good luck

Jeff Boyce
<Access MVP>
 
Top