Combo box default?

chris-uk-lad

Registered User.
Local time
Today, 00:24
Joined
Jul 8, 2008
Messages
271
Hi all,

I cant seem to work out how to get a combo box to display a value on loading the form. I want the Name John to be the default value on the list when the form loads up.

I have tried the following to no such luck.

Code:
cboName.ListIndex = 0 
Me.cboName.DefaultValue = "John"

Thanks
 
Me.cboName = Me.cboName.ItemData(0) assuming that John is the first item in the combobox.

I believe the ListIndex property is Read-Only and cannot be set and I suspect the problem with Me.cboName.DefaultValue = "John" is that the DefaultValue only comes into play when a new record is generated. A simple Me.cboName.Value = "John" or Me.cboName = "John" (which is the same thing) should also work.
 
worked a treat, ty
 

Users who are viewing this thread

Back
Top Bottom