Dropdown combo values dependent on another combo

G

Guest

I have seen other posts on this topic and tried the solutions but without
success, so here is my query:
I have tables for Inquiries, Companies and Contacts.
At some of the companies, there will be several contacts.
The Companies table is related to the Contacts table via CompanyID, with a
one to many (type 2) link.
On my Inquiries form I have a combo that allows selection of the Company
that is involved, and another combo for the Contact we are dealing with on
that particular Inquiry.
Having selected the Company, I want the Contacts shown in the Contacts combo
to be limited to just those at that Company (sometimes there'll be just the
one, sometimes several).
I would really appreciate advice on how to set up the combos on the form to
achieve what I want (and is my table structure OK?).
Many thanks
CW
 
G

Guest

This may be an easier way of coding.

In the row source of the second combo box, select the underlying query.
(Press the button which shows three dots [...])

In the criteria row of this query, use the build function (I think its right
click and select build)

Select loaded forms, select the for where your first combo is, select the
first combo box.

This should populate the criteria row as follows

[Forms]![Frm_General_Enquiries]![MarketCombo91]

Only it will show your form names not mine. What it is actually doing is
setting the criteria of the second combo box to the selection in the first.
The code shown performs exactly the task that you requested.

HTH Mike

--
An Engineers Prayer:
At the very end of the day,
when all else fails,
you have tried all
and asked everyone you know,
read the instruction manual.
 
G

Guest

Sorry, forgot to mention, the criteria change should be in the company name
field of the underlying query, pity one cannot print pictures here.
--
An Engineers Prayer:
At the very end of the day,
when all else fails,
you have tried all
and asked everyone you know,
read the instruction manual.


MikeJohnB said:
This may be an easier way of coding.

In the row source of the second combo box, select the underlying query.
(Press the button which shows three dots [...])

In the criteria row of this query, use the build function (I think its right
click and select build)

Select loaded forms, select the for where your first combo is, select the
first combo box.

This should populate the criteria row as follows

[Forms]![Frm_General_Enquiries]![MarketCombo91]

Only it will show your form names not mine. What it is actually doing is
setting the criteria of the second combo box to the selection in the first.
The code shown performs exactly the task that you requested.

HTH Mike

--
An Engineers Prayer:
At the very end of the day,
when all else fails,
you have tried all
and asked everyone you know,
read the instruction manual.


CW said:
I have seen other posts on this topic and tried the solutions but without
success, so here is my query:
I have tables for Inquiries, Companies and Contacts.
At some of the companies, there will be several contacts.
The Companies table is related to the Contacts table via CompanyID, with a
one to many (type 2) link.
On my Inquiries form I have a combo that allows selection of the Company
that is involved, and another combo for the Contact we are dealing with on
that particular Inquiry.
Having selected the Company, I want the Contacts shown in the Contacts combo
to be limited to just those at that Company (sometimes there'll be just the
one, sometimes several).
I would really appreciate advice on how to set up the combos on the form to
achieve what I want (and is my table structure OK?).
Many thanks
CW
 
G

Guest

Thanks for your suggestions, got it working now
Thanks
CW

MikeJohnB said:
Sorry, forgot to mention, the criteria change should be in the company name
field of the underlying query, pity one cannot print pictures here.
--
An Engineers Prayer:
At the very end of the day,
when all else fails,
you have tried all
and asked everyone you know,
read the instruction manual.


MikeJohnB said:
This may be an easier way of coding.

In the row source of the second combo box, select the underlying query.
(Press the button which shows three dots [...])

In the criteria row of this query, use the build function (I think its right
click and select build)

Select loaded forms, select the for where your first combo is, select the
first combo box.

This should populate the criteria row as follows

[Forms]![Frm_General_Enquiries]![MarketCombo91]

Only it will show your form names not mine. What it is actually doing is
setting the criteria of the second combo box to the selection in the first.
The code shown performs exactly the task that you requested.

HTH Mike

--
An Engineers Prayer:
At the very end of the day,
when all else fails,
you have tried all
and asked everyone you know,
read the instruction manual.


CW said:
I have seen other posts on this topic and tried the solutions but without
success, so here is my query:
I have tables for Inquiries, Companies and Contacts.
At some of the companies, there will be several contacts.
The Companies table is related to the Contacts table via CompanyID, with a
one to many (type 2) link.
On my Inquiries form I have a combo that allows selection of the Company
that is involved, and another combo for the Contact we are dealing with on
that particular Inquiry.
Having selected the Company, I want the Contacts shown in the Contacts combo
to be limited to just those at that Company (sometimes there'll be just the
one, sometimes several).
I would really appreciate advice on how to set up the combos on the form to
achieve what I want (and is my table structure OK?).
Many thanks
CW
 

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

Top