Setting first row in combo box as default.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 
Proko said:
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)
 
Thankyou so much!! Works great.

Jeff Boyce said:
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
 

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

Similar Threads


Back
Top