Repopulating combo-boxes

D

David

My system has one combo box that the selection affects the contents of all other combo boxes
My combo boxes all have the logic that only loads them in the 'on focus' event if the rowsource is blank
What is the best way to have all the dependent combo boxes reload when the other combo box selection is changed. Right now I am setting all the other rowsources to blank, but is there a better way?
 
E

es

In the AfterUpdate Event on the first combo box put the
following code

me.combobox2.requery
me.combobox3.requery

And so on. This will Update the values in the other combo
boxes based on the first.

-----Original Message-----
My system has one combo box that the selection affects
the contents of all other combo boxes.
My combo boxes all have the logic that only loads them in
the 'on focus' event if the rowsource is blank.
What is the best way to have all the dependent combo
boxes reload when the other combo box selection is
changed. Right now I am setting all the other rowsources
to blank, but is there a better way?
 
D

David

Thanks for the reply but I dont want to repopulate any combo box until it has the focus.
 
D

david

In that case, go to the Event "On Got Focus" for the combo
box and apply the code Me.(cmbName).Requery Method to it
at that point. That should only requery the combo box
data upon the combo box receiving the focus. However,
there are times when I've had to apply Me.Recalc
instead...not 100% sure why sometimes Recalc is needed
instead of Requery, but it happens sometimes. The Recalc
function recalculates the entire form, but does it fast
enough (usually) that the end user does not notice.

-----Original Message-----
Thanks for the reply but I dont want to repopulate any
combo box until it has the focus.
 

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