Takunda Mafuta
Registered User.
- Local time
- Yesterday, 22:53
- Joined
- Sep 4, 2019
- Messages
- 13
I am a newbie to MS Access VBA. I want to lock fields on a form (PaymentRequest) "Payment Request 1" using a checkbox such that if I go to the next form (PaymentRequest) "Payment Request 2" the fields will be editable until I also lock them with a checkbox on that particular form. I have tried to use the following code but it is locking not just the fields on the current form but also fields on all the subsequent forms instead which is not what I want. The code is as below:
Also take a look at the screenshot and the subject database file I have attached.
Code:
Private Sub ApprovedHOD_AfterUpdate()
If IsNull(ApprovedHOD.Value) Then
Me.Department.Locked = False
Me.Payee.Locked = False
Me.NatureOfPayment.Locked = False
Me.Currency.Locked = False
Else:
Me.Department.Locked = True
Me.Payee.Locked = True
Me.NatureOfPayment.Locked = True
Me.Currency.Locked = True
End If
End Sub
Also take a look at the screenshot and the subject database file I have attached.