Listbox Parameter Query??

G

Guest

When my Query asks me "Which Subcontractor?" how can I have a drop down list
box with my contractors appear for selection? thanks.
 
J

Jeff Boyce

Rich

Your subject: specified a "listbox". You wouldn't need to do it this way.

If you wish to use a selection approach in your query, you'll need to create
a form.

On that form, use a combo box to allow the selection of a single
subcontractor.

In your query, in the criterion "cell" under the Subcontractor field, you
will point to the form's combobox for the query to find its criterion.

Note that this approach requires that the form is open and a value selected.

Note also that if your underlying table structure includes "lookup" data
type fields, you, Access and your query could get very confused!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

"Note that this approach requires that the form is open and a value selected."

I'm sure I'm missing something here, but I want the query to poll me for a
value with the drop down box, and not select one first with the form and then
run the query.

*confused*

Jeff Boyce said:
Rich

Your subject: specified a "listbox". You wouldn't need to do it this way.

If you wish to use a selection approach in your query, you'll need to create
a form.

On that form, use a combo box to allow the selection of a single
subcontractor.

In your query, in the criterion "cell" under the Subcontractor field, you
will point to the form's combobox for the query to find its criterion.

Note that this approach requires that the form is open and a value selected.

Note also that if your underlying table structure includes "lookup" data
type fields, you, Access and your query could get very confused!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

Jeff Boyce

Yes, I understand. No, a query cannot do that.

You'll have to use a form to get either a listbox or a combo box.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Niniel said:
"Note that this approach requires that the form is open and a value
selected."

I'm sure I'm missing something here, but I want the query to poll me for a
value with the drop down box, and not select one first with the form and
then
run the query.

*confused*
 
G

Guest

Hm, that's too bad.
But can a form do the work of my query? I'm linking 2 tables via a "name"
and "last name" field in order to display only records for a certain person.
 
G

Guest

Niniel;
I agree. I want to do it your way. Any suggestions?
--
Rich D
Armstrong Custom Homes
Redmond


Niniel said:
"Note that this approach requires that the form is open and a value selected."

I'm sure I'm missing something here, but I want the query to poll me for a
value with the drop down box, and not select one first with the form and then
run the query.

*confused*
 
J

Jeff Boyce

I'm not saying the form replaces the query. You need the form to gather the
criterion value, and the query to do the "heavy lifting" (the query "points"
to the form to find the criterion).

That's why the form needs to be open for this approach to work. Otherwise,
the query looks for a value and can't find the form.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

Ok.
In that case, would you be able to give me some pointers as to how to make
them work together? And would it be enough for the form to just contain the
name fields?
I tried to make it work right after I read your reply, but even though the
query appears to be using the form to pull in the data, I still didn't get
the combo box effect in the parameter input dialog.
 
J

Jeff Boyce

You won't get the combo box in the parameter dialog. The combo box is in
the form.

You replace the original parameter in the query with a reference to the
form's combo box ... something like:

Forms!YourFormName!YourComboBoxName

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

Ok, I finally got it. Took me a while to wrap my head around the different
approach that is required for this to work.
Thanks a lot for all your help!
 

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

Similar Threads


Top