combo box - select and highlight default item ?

G

Guest

Hi

In a PROVINCE combo box , how do I select a default and highlight the item in the combo box

Me.cboReporterProvince.DefaultValue = cboReporterProvince.ItemData(0)

ItemData(0) is the item that has the Province I would like to make it the default. Internally, the combo holds the value but on the GUI it does not show this province in the combox box - it remains a blank box.
 
D

david

I'm guessing you want the default value to appear when the
form is opened. Try using in On Open a

Me.cboReporterProvince.Value =
cboReporterProvince.ItemData(0)

However, if you have are manuevering through several
records, you might consider a simple

If IsNull(Me.cboReporterProvince) Then
Me.cboReporterProvince.Value =
cboReporterProvince.ItemData(0)
End If

On the other hand, if you are always going to have the
same province be the default, then just use

Me.cboReporterProvince.Value = "ProvinceName"

Not sure if any of this helps, but good luck!
-----Original Message-----
Hi,

In a PROVINCE combo box , how do I select a default and
highlight the item in the combo box ?
Me.cboReporterProvince.DefaultValue = cboReporterProvince.ItemData(0)

ItemData(0) is the item that has the Province I would
like to make it the default. Internally, the combo holds
the value but on the GUI it does not show this province in
the combox box - it remains a blank box.
 

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