Default Field Values

poet1234

Registered User.
Local time
Today, 15:44
Joined
Oct 7, 2004
Messages
46
I have a form (form1 in the sample code below) with three combo boxes. I set each combo box to have a specific default value. However, I want to give the user the ability to reset the default values. I accomplished this by creating a pop-up (form2 in the sample code below) form that has the identical combo boxes (without default values). They can select from the pull-down menus, click a button. Behind the button is the following code:

forms!form1!cbo1 = me.cboA
forms!form1!cbo2 = me.cboB
forms!form1!cbo3 = me.cboC

docmd.close acform, "form1", acSaveYes
docmd.close acform, "form2"


It works fine, the only problem is that when I close the original form, then open it again, all of the combo boxes have the original default values. It is like the new default values that the user selects don't "stick."
What am I doing wrong?
 
poet,

The techniques that you're using apply to data. You need something like:

DoCmd.OpenForm "frmDemo", acDesign
Forms![frmDemo]![txtField1].DefaultValue = 9
DoCmd.Close acForm, "frmDemo", acSaveYes

Wayne
 

Users who are viewing this thread

Back
Top Bottom