default text for ComboBox (1 Viewer)

eugzl

Member
Local time
Today, 08:16
Joined
Oct 26, 2021
Messages
125
Hi All.
I have form with some ComboBoxes. To display default text in load form event I add code:
Code:
Private Sub Form_Load()
    Me.cboBrand = "Select Brand"
    Me.cboBrand.ForeColor = 11250603
    Me.cboDeviceType = "Select Device Type"
    Me.cboDeviceType.ForeColor = 11250603
    Me.cboModel = "Select Model"
    Me.cboModel.ForeColor = 11250603
    Me.cboDevice = "Select Hardware"
    Me.cboDevice.ForeColor = 11250603
End Sub
When I ran the form only cboBrand display default text. How to fix the problem?

Thanks
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:16
Joined
Oct 29, 2018
Messages
21,358
Are all your comboboxes bound to text fields?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:16
Joined
May 7, 2009
Messages
19,175
combobox Row starts with 0 (first row).
determine the row number of the item you want
to display initially.
on the Load event of the form (replace "the_row_number_here (without quote) with the actual row number):

...
Me.cboBrand =Me.cboBrand.ItemData(the_row_number_here)
Me.cboDeviceType =Me.cboDeviceType.ItemData(the_row_number_here)
...
 

Users who are viewing this thread

Top Bottom