Default Display on Combo Boxes

jsanders

If I Only had a Brain
Local time
Today, 03:49
Joined
Jun 2, 2005
Messages
1,940
Is there a way to force a combo box to display the first value in the list as its default value?

To be more specific the combo box needs to display this value when the parent form is opened or when you use VBA to change or add the row source.

When ever I use a saved query as the row source the default value is always Null.

Thanks Everyone,
Joe
 
Try using the Dfirst function to assign a value to your combobox when
the form is loaded or activated.

e.g. Me.combobox.value = Dfirst("[fieldname]","tablename")

I have not tested this, so I do not guarantee success.
 
another way...

Me!ComboName.DefaultValue = Me!ComboName.ItemData(0)
 
Thank you Both,
I tried this way first
Me!ComboName.DefaultValue = Me!ComboName.ItemData(0)
and it works perfectly.

I didn't try the other so I can't comment on it.
This forum has some of the most willing and giving members.
 

Users who are viewing this thread

Back
Top Bottom