Combo Box default value.

dawkirst

Registered User.
Local time
Today, 21:31
Joined
Sep 1, 2005
Messages
21
Hi guys,

In my form I have a combo box that is bound to a product/specification table.

When clicked, this combo box displays a list of products, each with its respective set of specifications (although I configured it so just the product column can be seen.) The reason I do this, is so that the specification values (against which certain other values in the form is critiqued) will be a static value in the form itself, and not a changeable value in a table.

What I want to do, however, is to let the combo box assume a default value when the form load (it must already have a product selected at start-up.)

How can I do this?

Thanks ahead!
 
In Form Load event put...

Me!ComboName.DefaultValue = Me!ComboName.ItemData(0)
 
Thanks.

Me!ComboName.DefaultValue = Me!ComboName.ItemData(0)

ComboName being the ComboBox's name.

DefualtValue? Is this merely a property control, or a user defined value, like ComboName?

ItemData(0)?

I apologize, I'm not a programmer.
 
it is a Property of the control.
Me!ComboName.DefaultValue is the same as setting 'Default Value' in the property sheet for the control

So the only bits you should need to tweak is the ComboName


Peter
 
Thanks.

I entered this code:

Private Sub Form_Load()
Me!Product.DefaultValue = Me!Product.ItemData(0)
End Sub

(Product being my Combo Box's name.)

However, I get a #Name? in the Combo Box now. Any ideas?
 

Users who are viewing this thread

Back
Top Bottom