Can I load a bound combo box from VBA ?

dcavaiani

Registered User.
Local time
Yesterday, 21:54
Joined
May 26, 2014
Messages
385
Is there a way to load a bound combo box using IF statements in VBA? I am trying to load the combo box from a field from 2 different tables - depending on the value of a preceding field. Possible ??
 
Hi. Of course, you would just modify its Row Source property.
 
Hi. Of course, you would just modify its Row Source property.

You make it sound so easy ..... Could I leave one source in the combo field definition and provide IF vba code to select the values from a different source ? Or, maybe it wud be simpler to hard code the "other" values in the VBA to avoid the SELECT issues?
 
Last edited:
You make it sound so easy ..... Could I leave one source in the combo field definition and provide IF vba code to select the values from a different source ? Or, maybe it wud be simpler to hard code the "other" values in the VBA to avoid the SELECT issues?
Hi. Yes, you can, but you'll probably end up doing both in VBA as well anyway depending on where/how the combobox is used.
 
Thanks theDBguy - U gave me confidence and looks like I got it !!
 
Your description of having the RowSource come from two different tables suggests you have not normalized properly.

I expect you should have the RowSource records all in the one table with an extra field to select which of them is associated with the value in the "preceding field". The RowSource query simply refers to that control in the Where clause. A Requery of the combo is done in the Form OnCurrent and the "previous field's" Control AfterUpdate.
 

Users who are viewing this thread

Back
Top Bottom