I’m having a problem getting the AllowEdits property to work.
Here is the issue. I have a form - frmOrders . The forms Form_Current event has the following line of code:
AllowEdits = False
This works fine and when the user tries to edit a field on the form he is unable to. However, if the user clicks in or enters the control cboLookup1 and then navigates to any other control on the form he is able to edit the form. In other words the form has now reset itself to allow edits in any and all fields.
There are 4 control properties named cboLookup1, cboLookup2, cboLookup3, and cboLookup4. If the user clicks or enters any one of these fields and then exits to another field the form then allows edits.
There is code associated with these fields.
Here is the code that is in the LostFocus event on the combo box control cboLookUp1.
The other 3 controls have the same code.
I know it has something to do with this code because I’ve removed the code and the form will stay read only if this code does not fire. Yes, I’ve tried putting AllowEdits = False statements in the LostFocus events and that doesn’t help.
If anyone can offer any help it would be greatly appreciated.
Thanks for your time.
Here is the issue. I have a form - frmOrders . The forms Form_Current event has the following line of code:
AllowEdits = False
This works fine and when the user tries to edit a field on the form he is unable to. However, if the user clicks in or enters the control cboLookup1 and then navigates to any other control on the form he is able to edit the form. In other words the form has now reset itself to allow edits in any and all fields.
There are 4 control properties named cboLookup1, cboLookup2, cboLookup3, and cboLookup4. If the user clicks or enters any one of these fields and then exits to another field the form then allows edits.
There is code associated with these fields.
Here is the code that is in the LostFocus event on the combo box control cboLookUp1.
Code:
Private Sub cboLookUp1_LostFocus()
Dim varExtCost As Variant
Dim varItem As Variant
Dim varCost As Variant
varItem = DLookup("descript", "tblItems", "[ItemNo]=cbolookup1")
If (Not IsNull(cboLookUp1)) Then Me![txtItem1] = varItem
varCost = DLookup("cost", "tblItems", "[ItemNo]=cbolookup1")
If (Not IsNull(cboLookUp1)) Then Me![txtCost1] = varCost
varExtCost = Nz(txtQty1, 0) * Nz(txtCost1, 0)
If (Not IsNull(txtQty1)) Then Me![txtExt1] = varExtCost
End Sub
The other 3 controls have the same code.
I know it has something to do with this code because I’ve removed the code and the form will stay read only if this code does not fire. Yes, I’ve tried putting AllowEdits = False statements in the LostFocus events and that doesn’t help.
If anyone can offer any help it would be greatly appreciated.
Thanks for your time.