default value doesn't stick

  • Thread starter Thread starter Bill H.
  • Start date Start date
B

Bill H.

I set a default value for a combo box when a change is made to the combo
box. The idea being that when the form is opened again, the combo box will
have the last value selected.

Problem is, it don't work! It always "remembers" the first one I selected
after manually clearing out the default value, but when it puts one it, it
never remembers.

huh?

This is what I have:

Private Sub Site_Select_Combo_AfterUpdate()
Me!Site_Select_Combo.DefaultValue = Me!Site_Select_Combo.Column(0)
End Sub

Do I somehow have to tell the form to "save" this default value?
 
Yes, you do. Add acSaveYes to your close statement
DoCmd.Close acForm, FormName, acSaveYes.

Technically, changing the default value of a control is a design change.
What you need to also be aware of is if any other changes have been made you
don't want to keep, you will have to deal with that.
 
Defaultvalue defines what value the bound control takes upon navigation
to a new record.
If your combobox is unbound, you can consider storing the value in some
table, and retrieve (and assign) it on form_load
 
Back
Top