David Ball
Registered User.
- Local time
- Today, 14:55
- Joined
- Aug 9, 2010
- Messages
- 230
Hi,
I have a form containing a subform. The subform has a combo box (FIC Number) that the user can select values from. I want the combo box to be read only until the user presses an “Edit Profiles” button. The user can scroll through the main form and view "Profiles" that have been previously set up but can not change any Profiles until they press the "Edit Profiles" button.
I have tried using an “On Open” event procedure for the Form as below:
Private Sub Form_Open(Cancel As Integer)
Forms![formEquipmentType]![subformTestEquip/FIC Subform]![FIC Number].Enabled = False
End Sub
Initially I got an error message "You can not disable a control while it has the focus".
I tried setting the Focus onto the cmdClose button first (as per below) but still get the same message.
Private Sub Form_Open(Cancel As Integer)
cmdClose.SetFocus
Forms![formEquipmentType]![subformTestEquip/FIC Subform]![FIC Number].Enabled = False
End Sub
Is there a way to disable the combo box in the subform so that it is read-only on opening the form, until the “Edit Profiles” button is selected?
I think I am OK on setting up the "Edit Profiles" button and associated code, I just need help with disabling the combo box when the form opens.
Thanks very much.
Dave B
I have a form containing a subform. The subform has a combo box (FIC Number) that the user can select values from. I want the combo box to be read only until the user presses an “Edit Profiles” button. The user can scroll through the main form and view "Profiles" that have been previously set up but can not change any Profiles until they press the "Edit Profiles" button.
I have tried using an “On Open” event procedure for the Form as below:
Private Sub Form_Open(Cancel As Integer)
Forms![formEquipmentType]![subformTestEquip/FIC Subform]![FIC Number].Enabled = False
End Sub
Initially I got an error message "You can not disable a control while it has the focus".
I tried setting the Focus onto the cmdClose button first (as per below) but still get the same message.
Private Sub Form_Open(Cancel As Integer)
cmdClose.SetFocus
Forms![formEquipmentType]![subformTestEquip/FIC Subform]![FIC Number].Enabled = False
End Sub
Is there a way to disable the combo box in the subform so that it is read-only on opening the form, until the “Edit Profiles” button is selected?
I think I am OK on setting up the "Edit Profiles" button and associated code, I just need help with disabling the combo box when the form opens.
Thanks very much.
Dave B