Setting a combo box to an initial value

G

Guest

I have a combo box which sets a form which sets subforms on that form. The
only problem is that the combo box doesn't have a value when it initially
loads, it's blank. What sort of method should I have the onLoad event call
to have the Combo box start off with a value listed? Perhaps there's some
sort of "next" feature that would bump the combo box to the next (first)
listed value in its rowsource?
 
M

Marshall Barton

Banaticus said:
I have a combo box which sets a form which sets subforms on that form. The
only problem is that the combo box doesn't have a value when it initially
loads, it's blank. What sort of method should I have the onLoad event call
to have the Combo box start off with a value listed? Perhaps there's some
sort of "next" feature that would bump the combo box to the next (first)
listed value in its rowsource?


If it's a bound control, you probably do not want to set the
combo box's value and dirty the record. If that's not an
issue, use:

Me.combobox = Me.combobox.ItemData(0)

but, it's probably better to set then combo box's
DefaultValue property instead:

Me.comboboxDefaultValue = _
"""" & Me.combobox.ItemData(0) & """"
 

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