Default values for drop-down list box

  • Thread starter Thread starter Ray Ash
  • Start date Start date
R

Ray Ash

How do I make it so that drop-down boxes on forms default
to a particular value within the box? All it does now is
default to a blank value.
 
There is a default value property for combo-boxes in form
design. It is on the Data tab of the properties sheet.
Enter the value you want displayed by default there.

HTH

-Mike
 
I have tried changing the default value property in Design
View, but when I go back into the form to add a new record
it still defaults to a blank value.
 
I assume that you mean a Combo Box and not a List Box and
that it is unbound. If it were bound, it would
automatically show the value in the first record.
You can have it take on the value of a row in the dropdown
list by trying the following code for the OnEnter event of
the Combo Box:

Me![comboboxname].Dropdown
Me![comboboxname] = Me![comboboxname].Column(0,0)

In this case, the first value in the list would become the
default. You could change the second index value of the
Column property to access other row values.
 
The default value has to be based on the bound column not the what is shown.
If the bound column is an ID and a name is being shown, set the default to
the ID of the name you want to show. If you set the default to the name,
the box cannot find that name in the list of IDs so it will not set a value.

Kelvin
 
Back
Top