Need command button to link to combo box

  • Thread starter Thread starter Kate
  • Start date Start date
K

Kate

Hello,

I have a combo box with a list of names. Each person also
has a query. I would like to make it so that the person
clicks on their name and clicks a command button, which
will pull up their query.

But I can't figure out how to link the queries to the
names in the list box, and then the list box to the
command button.

I'm new at this. Thanks for the help...

Kate
 
Hi Kate,

Why does each person have a query? I am guessing that each query filters the
data for the given person. Instead of having a whole slew of queries you
really only need one query that has a parameter referring to the selected
name in the combo box. Let's say that your combo is named PersonId and it is
bound to the PersonID field of your table. In the query, under the personId
column you would put the following:

forms!MyForm!PersonID

Replace *MyForm* with the actual name of your form and *PersonID* with the
name of your combo. Save the query. Now when you open the query the data
will be filtered to show only those rows matching the PersonID of the
current record in your form.
 
Thanks for the response.

Actually, each name has several different agencies, and
the names are not actually on the table that the combo box
is pulling from. Can I resolve it this way without the
names in the table?

Thanks for clarifying,
Kate
-----Original Message-----
Hi Kate,

Why does each person have a query? I am guessing that each query filters the
data for the given person. Instead of having a whole slew of queries you
really only need one query that has a parameter referring to the selected
name in the combo box. Let's say that your combo is named PersonId and it is
bound to the PersonID field of your table. In the query, under the personId
column you would put the following:

forms!MyForm!PersonID

Replace *MyForm* with the actual name of your form and *PersonID* with the
name of your combo. Save the query. Now when you open the query the data
will be filtered to show only those rows matching the PersonID of the
current record in your form.

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

Hello,

I have a combo box with a list of names. Each person also
has a query. I would like to make it so that the person
clicks on their name and clicks a command button, which
will pull up their query.

But I can't figure out how to link the queries to the
names in the list box, and then the list box to the
command button.

I'm new at this. Thanks for the help...

Kate


.
 
In that case there should probably be a table that relates names to agencies
and this table should be included in the query. Then the parameter for the
person's name would still be used as a filter.

Unless the queries are vastly different (ie different tables and different
fields) for each name I suspect that this is still just a matter of creating
one query that is filtered by the combo. If you'd like more help with the
actual query then feel free to post back more details about the query and
the underlying tables and fields.

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

Thanks for the response.

Actually, each name has several different agencies, and
the names are not actually on the table that the combo box
is pulling from. Can I resolve it this way without the
names in the table?

Thanks for clarifying,
Kate
-----Original Message-----
Hi Kate,

Why does each person have a query? I am guessing that each query
filters the data for the given person. Instead of having a whole
slew of queries you really only need one query that has a parameter
referring to the selected name in the combo box. Let's say that your
combo is named PersonId and it is bound to the PersonID field of
your table. In the query, under the personId column you would put
the following:

forms!MyForm!PersonID

Replace *MyForm* with the actual name of your form and *PersonID*
with the name of your combo. Save the query. Now when you open the
query the data will be filtered to show only those rows matching the
PersonID of the current record in your form.

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

Hello,

I have a combo box with a list of names. Each person also
has a query. I would like to make it so that the person
clicks on their name and clicks a command button, which
will pull up their query.

But I can't figure out how to link the queries to the
names in the list box, and then the list box to the
command button.

I'm new at this. Thanks for the help...

Kate


.
 
Back
Top