How do I set a Default value for a Combobox? (1 Viewer)

David Ball

Registered User.
Local time
Tomorrow, 05:47
Joined
Aug 9, 2010
Messages
230
Hi,

I have a Combobox called cmbLevel and want to set a default value. The default I want is “Standard” and this is a value in the table that is the source for the combo box.
What would I need to put in the Expression Builder or the Default Value row of the Data tab in the Property Sheet?
Thanks very much
Dave
 

GinaWhipp

AWF VIP
Local time
Today, 16:17
Joined
Jun 21, 2011
Messages
5,899
In the Property Sheet of the Combo Box on the Data Tab is where you enter the Default Value.
 

JHB

Have been here a while
Local time
Today, 22:17
Joined
Jun 17, 2012
Messages
7,732
You need to put in the ID Number ("IDNo") as the default value.
 

Attachments

  • DefaultValue.jpg
    DefaultValue.jpg
    75.1 KB · Views: 6,758

David Ball

Registered User.
Local time
Tomorrow, 05:47
Joined
Aug 9, 2010
Messages
230
Thanks so much, JHB, that was the missing bit of info I needed!
 

JHB

Have been here a while
Local time
Today, 22:17
Joined
Jun 17, 2012
Messages
7,732
You're welcome, good luck. :)
 

David Ball

Registered User.
Local time
Tomorrow, 05:47
Joined
Aug 9, 2010
Messages
230
Actually, it still doesn't work. The Combo Box is on my Form. When I enter a number, say 1, in the Default Value nothing appears in the combo box on the form unless I select a value.
 

JHB

Have been here a while
Local time
Today, 22:17
Joined
Jun 17, 2012
Messages
7,732
Then post your database with some sample data, zip it + name of the form with problem and the control name.
 

Gasman

Enthusiastic Amateur
Local time
Today, 21:17
Joined
Sep 21, 2011
Messages
14,274
Is that not only for new records.?


I use

Code:
ctrl.ItemData(n)
where n is the index number I want, generally 0


HTH



Actually, it still doesn't work. The Combo Box is on my Form. When I enter a number, say 1, in the Default Value nothing appears in the combo box on the form unless I select a value.
 

missinglinq

AWF VIP
Local time
Today, 16:17
Joined
Jun 20, 2003
Messages
6,423
As Gasman has suggested, it depends on what the Bound Column of the Combobox is. If the Combobox is based on a Table that has a RecordID, the RecordID is usually assigned and included in the Combobox, even it you didn't deliberately include it, when you constructed it.

On the other hand, if the Combobox is based on a ValueList, this won't be the case. If this is the case, try simply entering Standard as the Default Value.

Linq ;0)>
 

Users who are viewing this thread

Top Bottom