Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default value in Combo Box - Does not work

Status
Not open for further replies.

whatisahandle

Programmer
Jul 26, 2001
18
CA
Hi,

I have a combo box in a form header and would like to give it a default value so it is not blank when I first open the form.

In the combo properties there is a row source which works OK (i get a choice list), but no matter what I put in the "Defaut Value" property it does not show up when I open the form.

Any ideas ?

Chris
 
Go to the design view of the form. And go to the properties of the combo box. There is a data tab and it has a default value field you can chose.
 
Dear bobbster2000,

Thanks for wanting to help, but please read the post before answering: what you suggest is exactly what I have already tried as I said in the post.

Chris
 
This code will set the value in ComboBox named cboTitle to
Sales Manager when the form Loads.

Private Sub Form_Load()
Dim x As Integer
Select Case Me.cboTitle.ColumnHeads
Case True
For x = 1 To cboTitle.ListCount
If cboTitle.ItemData(x) = "Sales Representative" Then
cboTitle = cboTitle.ItemData(x)
Exit For
End If
Next x
Case Else
For x = 0 To cboTitle.ListCount - 1
If cboTitle.ItemData(x) = "Sales Representative" Then
cboTitle = cboTitle.ItemData(x)
Exit For
End If
Next x
End Select
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top