Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help needed setting enabled and locked properties

Status
Not open for further replies.

bravid98

Programmer
Jun 6, 2001
7
US
Here is the situation, I have a main form that loads that has a combo box on it that is locked and not enabled. I've made another form that will allow the combo box to either be unlocked and enabled, or have the default value changed to a value on the form. I've written some code but it doesn't seem to have any effect. Can anyone find the problem:

Private Sub Set_All_Click()
Form_frm_choose_location.Location_ID_frm.Enabled = True
Form_frm_choose_location.Location_ID_frm.Locked = False
End Sub

Private Sub Set_Click()
Form_frm_choose_location.Location_ID_frm.Enabled = False
Form_frm_choose_location.Location_ID_frm.Locked = True
Form_frm_choose_location.Location_ID_frm.DefaultValue = Me.Location
End Sub
 
Hi!

I think you took som mistakes of forms formulation.
You may write forms!Form_frm_choose_location!


Private Sub Set_All_Click()
forms!Form_frm_choose_location!Location_ID_frm.Enabled = True
forms!Form_frm_choose_location!Location_ID_frm.Locked = False
End Sub

or

Private Sub Set_All_Click()
forms("Form_frm_choose_location")("Location_ID_frm").Enabled = True
forms("Form_frm_choose_location")("Location_ID_frm").Locked = False
End Sub

or for active form

Private Sub Set_All_Click()
me.Location_ID_frm.Enabled = True
me.Location_ID_frm.Locked = False
End Sub

or

Private Sub Set_All_Click()
me!Location_ID_frm.Enabled = True
me!Location_ID_frm.Locked = False
End Sub

Aivars
 
Thanks for the help, however, I still am unable to get the default value to stay when the form is closed. I have tried adding a DoCmd.Save, however the new default value does not stay after the form is closed. Once the form is opened again the original default value comes back.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top