Selectable Parameters for a Query

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

Guest

I have a Query with output data. I only want to show one line of data. The
Line of data is to be chosen by someone who chooses the "Material Lot Number"
from a list of Lot Numbers. I would prefer to use a Combo box that has a
list of the "Lot Numbers" and the person can choose one so that all the
pertinent data is returned with that "Lot Number".

My first thought is that the Query could be already created, a form is
completed using that Query data and one would choose the "Lot Number" by
using a Combo Box. I have been having problems making it work. Could
someone offer advice or a solution?
 
Yes, suppose your combo name is "cbo" so u can come up with a query
like "SELECT * FROM TABLE WHERE COLUMN = " & cbo.value
 
I have a Query with output data. I only want to show one line of data. The
Line of data is to be chosen by someone who chooses the "Material Lot Number"
from a list of Lot Numbers. I would prefer to use a Combo box that has a
list of the "Lot Numbers" and the person can choose one so that all the
pertinent data is returned with that "Lot Number".

My first thought is that the Query could be already created, a form is
completed using that Query data and one would choose the "Lot Number" by
using a Combo Box. I have been having problems making it work. Could
someone offer advice or a solution?

You'll need to use a form to do this.
Adapt the below to your actual control and field names.

Make a new unbound form.
Add a combo box that will show the CircuitID field.
Make sure the Combo Box Bound Column is the
same DataType as the CircuitID field.
Add a command button.
Code the button's Click event:
DoCmd.OpenQuery "QueryName"
DoCmd.Close acForm, Me.Name
Name this form "ParamForm"

Code the Query CircuitID field criteria line
forms!ParamForm!ComboBoxName

Open the form.
Find the CircuitID in the combo box.
Click the command button.

The query will display just those records selected.
The Form will close.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top