AfterUpdate

I

Ivor Williams

On a form I have a number of combo boxes. After updating the value in
combo1, I would like to programatically have the focus advance to combo2 and
have combo2 open, so all the user need do is make a choice, updating the
value and advancing to the next combo, etc. Need some help with code for
this please.
 
F

fredg

On a form I have a number of combo boxes. After updating the value in
combo1, I would like to programatically have the focus advance to combo2 and
have combo2 open, so all the user need do is make a choice, updating the
value and advancing to the next combo, etc. Need some help with code for
this please.

One way is to set the Tab Order property of the 2 combo boxes so that
combo2 is the next one in the list after combo1.

Another method is to code the combo1 AfterUpdate event:
Me.Combo2.SetFocus
 
I

Ivor Williams

A second question. How can I restrict the choices in combo2 to only those
where field2 matches the value in combo? I want to carry on with this
pattern through 5 or 6 combos, ultimately ending up with only 1 or 2 choices
in the final combo.
 
F

fredg

A second question. How can I restrict the choices in combo2 to only those
where field2 matches the value in combo? I want to carry on with this
pattern through 5 or 6 combos, ultimately ending up with only 1 or 2 choices
in the final combo.

You can do this several ways.
The one I like is to leave the Combo2 rowsource blank and set it in
the Combo1 AfterUpdate event.
For example, if the rowsource of the combo boxes is a table and it
contains a list of Regions and Managers, and Combo1 displays the list
of Regions and Combo2 is used to select the Manager for that region,
code the Combo1 AfterUpdate Event:

Combo2.Rowsource = "Select TableName.Manager from TableName where
TableName.Region = """ & Me.[Region] & """"

The above assumes Region is a Text datatype field.
Do something similar for Combos 3, 4, and 5.

For additional information look up "Cascading Combo boxes" in
http://www.groups.google.com
 

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