default value doesn't stick

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?
 
G

Guest

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.
 
B

Bas Cost Budde

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top