Load a ComboBox without triggering another event

D

Dan

I have two combo boxes. One is loaded at run time.
The second is loaded with values that depend on the user's selection in the
first one.

So the ComboBox2 should load values only after the USER selects something in
ComboBox1.

When the program is loading ComboBox1, it appears to trigger ComboBox2. I
have tried the ComboBox1_change() and ComboBox1_Click() events, but they
don't work.

I hope that makes sense...

How can I prevent ComboBox2's event from firing while combobox1 is being
loaded, but allow it to run once the user makes a selection from combobox1?

Thanks!
dan
 
G

Gary''s Student

create a global, static boolean in a standard module. something like

arewethereyet

arewethereyet should be initialized to False.
ComboBox2 code should always examine arewethereyet and immediately exit if
it False. This will dismiss any accidental tripping of ComboBox2.

Have the ComboBox1 code set arewethereyet to True as the last thing it does.
This will allow ComboBox2 to run in the proper, subsequent, fashion.
ComboBox2 code should also restore arewethereyet to False prior to exit.
 

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