Force combo box to first item

PeterWieland

Registered User.
Local time
Today, 12:29
Joined
Sep 20, 2000
Messages
74
I have 2 combo boxes, the items in combo2 dependant on the item selected in combo1. I use the combo1 after update event to requery the list for the second box, but the last selected value in combo2 remains until a new value is selected. I can set the value to null, but as this is a required field in the underlying table, it really needs a valid value. How can I force the pointer to go to the first value in the new list?

Hope this makes sense. Any help appreciated.
 
In the AfterUpdate of combo1 create and open a recordset of the same query which is the rowsource for combo2. Do a Recordset.MoveFirst, then set the value of the displayed text field of combo2 equal to it's corresponding field in the recordset.

That will load the first value in the combo list each time you make a selection in combo1.

I hope this helps.
 
You can also do:

Me!<ControlName> = Me!<ControlName>.ItemData (0)
 

Users who are viewing this thread

Back
Top Bottom