A data prompt that is a combo box.

M

MartiFromOz

I have a query that prints out an IT inventory for a particular department at
work. When you run the query it prompts you to input the name of the
department. I am hoping it is possible to make this prompt a combo box so
that instead of having to remember all the departments exactly, you can just
choose. There is a table that has all the department names available.

Thanks for any help on this...
 
D

Dennis

You need to create a form. Place a combo box control on the form, let the
wizard create the combo using your departments table. In the criteria column
of your query for the department you can then enter

[Forms]![FormName]![ComboBoxName]

With your form open you can then select the department from the combo box &
your query will display data just for the department selected.
 
S

Shotodru

It is possible to make this into a combo box. The recordsource property may
be set to a field in a particular table containing only the list of all the
departments. This is more of an easier dynamic approach. Alternatively, you
may just type in the names of the departments separated by commas, in the
recordsource property.

Hope this helps.

Best regards,
Satadru
 
M

MartiFromOz

None of these have worked?????

The issue is that i cant get access to the criteria from outside of the
query itself.
 
J

John Vinson

None of these have worked?????

The issue is that i cant get access to the criteria from outside of the
query itself.

Marti, just what have you tried?

A criterion of

=Forms!NameOfForm!NameOfCombo

works well; you can also use exactly the same reference in VBA code,
in the control source of a textbox, etc.

You can't PROMPT the combo box; instead, you need to have the form
open. You can execute the query from a command button on the form, or
(better) open a Form for onscreen display or a Report (for printing)
based on the query.

John W. Vinson[MVP]
 
M

MartiFromOz

Thanks John,

the problem had to do with types. The new form was returning a id number
and i was querying for what the number pointed to. All fixed now.

-marti-
 
Top