D
DMUM via AccessMonster.com
Hello, I have a form that has multiple tabs. On one of the tabs I have a
button that updates a the table behind the forms with a date or deleted the
date depending upon if an issue is open or closed. After the date field is
updated, when a user opens another tab on the form, the form should be locked
or unlocked. Originally the lock was working, but the unlock was not. Now I
can get neither to work. Can anyone help me figure out what I am missing?
Here is my code:
If Nz(DLookup("WF_StartDate", "tblWF_Shop", "WF_Shop_Key =" & Forms!
hfrmGlobal!txtCurrWorkfile & ""), 0) <> 0 Then
If Nz(DLookup("WF_CompleteDate", "tblWF_Shop", "WF_Shop_Key =" & Forms!
hfrmGlobal!txtCurrWorkfile & ""), 0) Then
Me!sfrmWFLine.Locked = True
Me!sfrmWFLine.Form.cmdAddLine.Enabled = False
Me!sfrmWFLine.Form.cmdRecalc.Enabled = False
Me!sfrmWFLine.Form.cmdDeleteLines.Enabled = False
Me!sfrmWFDiscCustNote.Form.WF_DiscountAmt.Locked = True
Else
Me!sfrmWFLine.Locked = False
Me!sfrmWFLine.Form.cmdAddLine.Enabled = True
Me!sfrmWFLine.Form.cmdRecalc.Enabled = True
Me!sfrmWFLine.Form.cmdDeleteLines.Enabled = True
Me!sfrmWFDiscCustNote.Form.WF_DiscountAmt.Locked = False
End If
End If
If I go close the form and go back into the form, the form is locked/unlocked
correctly. As I said earlier, I know there is a possibility that I was
locking/unlocking the wrong subform, however, the lock was working fine using
the same code above.
Thanks
button that updates a the table behind the forms with a date or deleted the
date depending upon if an issue is open or closed. After the date field is
updated, when a user opens another tab on the form, the form should be locked
or unlocked. Originally the lock was working, but the unlock was not. Now I
can get neither to work. Can anyone help me figure out what I am missing?
Here is my code:
If Nz(DLookup("WF_StartDate", "tblWF_Shop", "WF_Shop_Key =" & Forms!
hfrmGlobal!txtCurrWorkfile & ""), 0) <> 0 Then
If Nz(DLookup("WF_CompleteDate", "tblWF_Shop", "WF_Shop_Key =" & Forms!
hfrmGlobal!txtCurrWorkfile & ""), 0) Then
Me!sfrmWFLine.Locked = True
Me!sfrmWFLine.Form.cmdAddLine.Enabled = False
Me!sfrmWFLine.Form.cmdRecalc.Enabled = False
Me!sfrmWFLine.Form.cmdDeleteLines.Enabled = False
Me!sfrmWFDiscCustNote.Form.WF_DiscountAmt.Locked = True
Else
Me!sfrmWFLine.Locked = False
Me!sfrmWFLine.Form.cmdAddLine.Enabled = True
Me!sfrmWFLine.Form.cmdRecalc.Enabled = True
Me!sfrmWFLine.Form.cmdDeleteLines.Enabled = True
Me!sfrmWFDiscCustNote.Form.WF_DiscountAmt.Locked = False
End If
End If
If I go close the form and go back into the form, the form is locked/unlocked
correctly. As I said earlier, I know there is a possibility that I was
locking/unlocking the wrong subform, however, the lock was working fine using
the same code above.
Thanks