Combo Boxes Based on one Another

  • Thread starter Thread starter Lindsay
  • Start date Start date
L

Lindsay

I am trying to create two combo boxes where the selection in the second
box is related to the selection in the first box, and these combo boxes
are in a subform. I have searched the web for guidance on this issue,
but every solution that I have found does not work. Do I have to use
unbound combo boxes or can I use bound combo boxes? Any specific
guidance would be greatly appreciated!
 
You can use bound combo boxes. I'm guessing that your problem has something
to do with the control reference in the rowsource query of the second combo.
The common examples are for controls on a main form and while the concept is
the same, you have to alter the reference in the where criteria a bit:

Here are two articles that describe how to do this on a main form. To make
it work on a subform just change the control reference to something like:

forms!frmMain!sfrmSubForm.form!MyCombo1

Replace "sfrmSubForm" above with the name of the subform control on the main
form. This is not necessarily the same as the name of the form object that
is referenced in the ControlSource of the subform control. To be sure, open
the main form and click once on the subform then check the name property
under the Other tab. Whatever you find there is what belongs in place of
sfrmSubForm.

How to Synchronize Two Combo Boxes on a Form
http://support.microsoft.com/default.aspx?scid=kb;EN-US;289670

ACC: How to Synchronize Two Combo Boxes on a Form (97624)
http://support.microsoft.com/default.aspx?scid=kb;[LN];97624
 
Lindsay,
I have a downloadable mdb (zipped file) that demonstrates "synched"
combos
in Access97, on my website (below) under Access Tips
It shows how to filter combo2 according to the value in combo1
 
I followed the instructions and there was an error (debug) message that
popped up when I was testing the boxes. It had a problem with the part
of the code { Me.product = Me.product.ItemData(0) }. Further help
would be greatly appreciated!
 
Thank you for your advice, but I am getting an error message when I try
and test it. It wants me to debug this part of the code

Me.product = Me.product.ItemData(0)
 
What is the error message?

Which method are you using? Are you using a saved query with a reference to
the control on the form or are you using an AfterUpdate event on the first
combo to rewrite the SQL for the second combo?

Post your code, your SQL for the rowsource query of the second combo and a
description of the controls involved.
 
Back
Top