Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

create a query that provides a drop down list to choose from

5 views
Skip to first unread message

john mcmichael

unread,
Dec 21, 2005, 10:42:03 AM12/21/05
to
I need to create a Query that when run, provides a menu of options to choose
from. These options can come from an existing table or I can type them in
while creating the query. Once the option is selected, the query should then
complete. I know that I can create a prompt for info using [] around a
statement in a criteria field. Choosing from a list is a better option for
people in this database but I do not know how to create this type of feature.

Thanks

Allen Browne

unread,
Dec 21, 2005, 10:50:25 AM12/21/05
to
It is not possible to get a drop-down list into the Parameter box offered by
a query.

If you create a form, and put the combo on the form, you can refer to it in
your query. For example, you could type this into the Criteria row in your
query:
[Forms].[Form1].[Combo65]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"john mcmichael" <johnmc...@discussions.microsoft.com> wrote in message
news:E66771CC-8BF4-4AB4...@microsoft.com...

Gwen H

unread,
Dec 21, 2005, 11:01:03 AM12/21/05
to
I have done something very similar using forms, and it works perfectly.
Create a form that includes either a list box or combo box field that lists
the "menu of options". Add a button that invokes your query. Then in your
query, in the field you're trying to filter on, use the following criteria:

[Forms]![formName]![listORcomboBOXname]

If you need to generate a report, base the report on the query. The button
on your form would need to invoke the report rather than the query.

You can also have the form open automatically when the database is opened,
if people who don't know Access are going to need to run this query and you
don't want them messing around with your tables and queries.

john mcmichael

unread,
Dec 21, 2005, 11:12:02 AM12/21/05
to
I have folks here at the office telling me that they have been able to do
this in previous versions of Access but htey can't remember how. Is this
something that has been removed from the software?

Thanks again.

john mcmichael

unread,
Dec 21, 2005, 11:27:04 AM12/21/05
to
Thank you both Allen and Gwen, but it doesnt seem to work. I have a form
called Sample and a combo box labeled Combo 5. When I open the form it work
properly, listing the options and letting me choose one. However, when
Itype the criteria [Forms]![Sample]![Combo5], the result is just a box that
waits for me type the criteria not providing me a list of options. ANy idea
where I'm falling off track?

Allen Browne

unread,
Dec 21, 2005, 11:37:28 AM12/21/05
to
No. The parameter box has never supported a drop-down list. It is not a
serious interface, is should be avoided if you are writing a serious
application.

The form must be open before the query if you expect the query to read the
value from the combo on the form.

If you have the form opened, and a value chosen in the combo, and then open
the query and still get asked for the parameter, then the reference to the
query is not typed correctly, e.g. there might be a space somewhere.

If this is a crosstab query, you must declare the parameter in the query.
It's a good idea to do that anyway. Choose Parameters on the query menu,
enter the full name of the parameter, and indicate the data type.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"john mcmichael" <johnmc...@discussions.microsoft.com> wrote in message

news:FFBC78F9-6918-4607...@microsoft.com...


>I have folks here at the office telling me that they have been able to do
> this in previous versions of Access but htey can't remember how. Is this
> something that has been removed from the software?
>
> Thanks again.
>
> "Allen Browne" wrote:
>
>> It is not possible to get a drop-down list into the Parameter box offered
>> by
>> a query.
>>
>> If you create a form, and put the combo on the form, you can refer to it
>> in
>> your query. For example, you could type this into the Criteria row in
>> your
>> query:
>> [Forms].[Form1].[Combo65]
>>

john mcmichael

unread,
Dec 21, 2005, 1:48:02 PM12/21/05
to
Thanks Allen...that will work!! I appreciate your help and happy holidays to
you.

:)@discussions.microsoft.com Carolyn :)

unread,
Aug 7, 2006, 9:52:01 PM8/7/06
to
I also tried doing what Allen & Gwen suggested, and also had no luck, can any
shed some light on this. It would be a really handy tool to be able to use a
drop down box in a query/Report, when you ahve many options to choose from.

Rick Brandt

unread,
Aug 7, 2006, 9:58:46 PM8/7/06
to
Carolyn :) wrote:
> "john mcmichael" wrote:
>
> > Thank you both Allen and Gwen, but it doesnt seem to work. I have
> > a form called Sample and a combo box labeled Combo 5. When I open
> > the form it work properly, listing the options and letting me
> > choose one. However, when Itype the criteria
> > [Forms]![Sample]![Combo5], the result is just a box that waits for
> > me type the criteria not providing me a list of options. ANy idea
> > where I'm falling off track?
> I also tried doing what Allen & Gwen suggested, and also had no luck,
> can any shed some light on this. It would be a really handy tool to
> be able to use a drop down box in a query/Report, when you ahve many
> options to choose from.
>

The form has to be opened and the choice made *before* you open the query or
report that references it. Is that what you tried?

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


Carolyn :)

unread,
Aug 13, 2006, 4:54:01 AM8/13/06
to

"Rick Brandt" wrote:

Hi Rick,

Yes that is what I did. I typed it in the criteria same way as suggested, I
had the form open and it still didn't work. I am unsure what I did, or what
I am doing wrong?
>
>
>

Dabears70

unread,
Dec 19, 2007, 2:57:00 PM12/19/07
to
Was this problem ever solved because I am having the same issue. Can somebody
please help me get a drop down menu in a parameter query. There are so many
items to chose from for the parameter that it is time saving to have a drop
down list.

Please help!

Thank you,
--
Nick

0 new messages