Is it possible to set the first row in a combo box as a default selection.
The combo's list is dynamic with its list dependant on a selection made in
another combo box. To explain a little more; I select a value in combo box 1.
Combo box 2 then has its list generated. I would like the first value in
combo box 2's list to be automatically selected. Any help would be greatly
appreciated. Thanks.
Jeff Boyce - 13 Jul 2007 18:19 GMT
A quick search on-line reveals a Microsoft KB article (105519) that shows
you can use:
Me!<ControlName> = Me!<ControlName>.ItemData(0)
to set the contents of the control (combo box) to the 1st (ItemData(0))
value in the combo box.
If your combo box uses the column names as headers, you'd use ItemData(1).
Regards
Jeff Boyce
Microsoft Office/Access MVP
> Is it possible to set the first row in a combo box as a default selection.
> The combo's list is dynamic with its list dependant on a selection made in
[quoted text clipped - 3 lines]
> combo box 2's list to be automatically selected. Any help would be greatly
> appreciated. Thanks.
Proko - 13 Jul 2007 18:38 GMT
Thankyou so much!! Works great.
> A quick search on-line reveals a Microsoft KB article (105519) that shows
> you can use:
[quoted text clipped - 18 lines]
> > combo box 2's list to be automatically selected. Any help would be greatly
> > appreciated. Thanks.
Marshall Barton - 13 Jul 2007 18:32 GMT
>Is it possible to set the first row in a combo box as a default selection.
>The combo's list is dynamic with its list dependant on a selection made in
>another combo box. To explain a little more; I select a value in combo box 1.
>Combo box 2 then has its list generated. I would like the first value in
>combo box 2's list to be automatically selected. Any help would be greatly
>appreciated.
After you set combo2's rowsource or requery it, use
Me.combo2 = me.combo2.Itemdata(0)

Signature
Marsh
MVP [MS Access]