Query with a Combo Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've searched the forum for my answer but can't seem to find one that matches
what I'm trying to do.

I have an unbound combo box on a form that queries a lookup table of query
names. The selection in the combo box is executed by a command button.

One of my queries is a select query. What I'd like to do is run the query
from my current design and have a combo box appear that queries values rather
than forcing a user to type a value.

Is this possible?

Thanks!
 
You need to use a combobox on a form to feed the query.

Check out this article for a detailed discussion.
http://www.fontstuff.com/access/acctut08.htm


A brief quote from an John Vinson (Access MVP) posting.

You'll need to create a small unbound Form (let's call it frmCriteria) with
a Combo Box control (cboCrit) on it. Use the combo box wizard to select the
table for the selections, and be
sure that the bound field of the combo is the value you want to use as a
criterion. Save this form.

Now use

=[Forms]![frmCriteria]![cboCrit]

as the criterion in your Query.

It's convenient to base a second Form or Report on the resulting query to
display the results; if you put a button on frmCriteria to launch that form
or report, the user can enter the criterion and view the results in one
simple operation!

Quoting John Vinson

Keywords: Parameter Queries
 
Thanks, John! I've followed this to the letter but when I execute the query
an "Enter Parameter Value" dialogue box appears with a field to type in a
value. Above the field is the string Forms!frmCBoxQueryCustomerNames!Brad

Any ideas what's wrong?

Thanks!

--
www.Marzetti.com


John Spencer said:
You need to use a combobox on a form to feed the query.

Check out this article for a detailed discussion.
http://www.fontstuff.com/access/acctut08.htm


A brief quote from an John Vinson (Access MVP) posting.

You'll need to create a small unbound Form (let's call it frmCriteria) with
a Combo Box control (cboCrit) on it. Use the combo box wizard to select the
table for the selections, and be
sure that the bound field of the combo is the value you want to use as a
criterion. Save this form.

Now use

=[Forms]![frmCriteria]![cboCrit]

as the criterion in your Query.

It's convenient to base a second Form or Report on the resulting query to
display the results; if you put a button on frmCriteria to launch that form
or report, the user can enter the criterion and view the results in one
simple operation!

Quoting John Vinson

Keywords: Parameter Queries
JohnLute said:
I've searched the forum for my answer but can't seem to find one that
matches
what I'm trying to do.

I have an unbound combo box on a form that queries a lookup table of query
names. The selection in the combo box is executed by a command button.

One of my queries is a select query. What I'd like to do is run the query
from my current design and have a combo box appear that queries values
rather
than forcing a user to type a value.

Is this possible?

Thanks!
 
Do you have the form (frmCBOXQueryCustomerNames) open? It must be open for
this to work.

Double check the name of the control on the form - "Brad" does not seem to
be a name I would give to a combobox.


JohnLute said:
Thanks, John! I've followed this to the letter but when I execute the
query
an "Enter Parameter Value" dialogue box appears with a field to type in a
value. Above the field is the string Forms!frmCBoxQueryCustomerNames!Brad

Any ideas what's wrong?

Thanks!

--
www.Marzetti.com


John Spencer said:
You need to use a combobox on a form to feed the query.

Check out this article for a detailed discussion.
http://www.fontstuff.com/access/acctut08.htm


A brief quote from an John Vinson (Access MVP) posting.

You'll need to create a small unbound Form (let's call it frmCriteria)
with
a Combo Box control (cboCrit) on it. Use the combo box wizard to select
the
table for the selections, and be
sure that the bound field of the combo is the value you want to use as a
criterion. Save this form.

Now use

=[Forms]![frmCriteria]![cboCrit]

as the criterion in your Query.

It's convenient to base a second Form or Report on the resulting query to
display the results; if you put a button on frmCriteria to launch that
form
or report, the user can enter the criterion and view the results in one
simple operation!

Quoting John Vinson

Keywords: Parameter Queries
JohnLute said:
I've searched the forum for my answer but can't seem to find one that
matches
what I'm trying to do.

I have an unbound combo box on a form that queries a lookup table of
query
names. The selection in the combo box is executed by a command button.

One of my queries is a select query. What I'd like to do is run the
query
from my current design and have a combo box appear that queries values
rather
than forcing a user to type a value.

Is this possible?

Thanks!
 
"Brad" was a typo. It's "Brand."

I've made some adjustments and things are now starting to work. Thanks for
your help and pointing out that great online resource!



--
www.Marzetti.com


John Spencer said:
Do you have the form (frmCBOXQueryCustomerNames) open? It must be open for
this to work.

Double check the name of the control on the form - "Brad" does not seem to
be a name I would give to a combobox.


JohnLute said:
Thanks, John! I've followed this to the letter but when I execute the
query
an "Enter Parameter Value" dialogue box appears with a field to type in a
value. Above the field is the string Forms!frmCBoxQueryCustomerNames!Brad

Any ideas what's wrong?

Thanks!

--
www.Marzetti.com


John Spencer said:
You need to use a combobox on a form to feed the query.

Check out this article for a detailed discussion.
http://www.fontstuff.com/access/acctut08.htm


A brief quote from an John Vinson (Access MVP) posting.

You'll need to create a small unbound Form (let's call it frmCriteria)
with
a Combo Box control (cboCrit) on it. Use the combo box wizard to select
the
table for the selections, and be
sure that the bound field of the combo is the value you want to use as a
criterion. Save this form.

Now use

=[Forms]![frmCriteria]![cboCrit]

as the criterion in your Query.

It's convenient to base a second Form or Report on the resulting query to
display the results; if you put a button on frmCriteria to launch that
form
or report, the user can enter the criterion and view the results in one
simple operation!

Quoting John Vinson

Keywords: Parameter Queries
I've searched the forum for my answer but can't seem to find one that
matches
what I'm trying to do.

I have an unbound combo box on a form that queries a lookup table of
query
names. The selection in the combo box is executed by a command button.

One of my queries is a select query. What I'd like to do is run the
query
from my current design and have a combo box appear that queries values
rather
than forcing a user to type a value.

Is this possible?

Thanks!
 
Back
Top