Blue 08 R6
New member
- Local time
- Today, 22:03
- Joined
- Dec 17, 2009
- Messages
- 8
Hi guys and girls,
Im having an issue with unlocking records for editing.
I have a check box on a form that is selected by our accounts dept and when it is checked and the focus is taken away from that record then it is locked for editing and deletion.
See code:
Now I have added a unlock button at the bottom of the form that requires a password to be entered to allow any editing or deletions of a record by authorised personnel.
See code:
The issue i am having is that if the correct password is entered the first time then the record is still locked for editing and deletion.
You physically have to enter an incorrect password and then click retry and enter the correct password for it to unlock the record.
Can anyone see what I have wrong in my code that would be causing the issue or having to enter an incorrect and then the correct password for it to work?
Also on an other note you will see the password is set to ACCOUNTS when entered into the input field it is incorrect, for some reason it is only picking up ACCOUNT (with out the S) as the correct password, missing out the last character happens for any word I set as the password.
Any thoughts on that?
Thank you in advance
Adam
Im having an issue with unlocking records for editing.
I have a check box on a form that is selected by our accounts dept and when it is checked and the focus is taken away from that record then it is locked for editing and deletion.
See code:
Code:
Private Sub Form_Current()
If Me.Check34 = True Then
Me.AllowAdditions = True
Me.AllowDeletions = False
Me.AllowEdits = False
Else
Me.AllowAdditions = True
Me.AllowDeletions = True
Me.AllowEdits = True
End If
End Sub
Now I have added a unlock button at the bottom of the form that requires a password to be entered to allow any editing or deletions of a record by authorised personnel.
See code:
Code:
Private Sub ALLOWEDITBUTTONS_Click()
On Error GoTo Err_ALLOWEDITBUTTONS_Click
Retry:
Dim strInput As String
strInput = InputBox("Please Enter the Password", "Enter Password")
If strInput = "ACCOUNTS" Then
If Me.Check34 = True Then
Me.AllowAdditions = True
Me.AllowDeletions = True
Me.AllowEdits = True
End If
If MsgBox("You entered the wrong password. Do you wish to try again?", vbQuestion + vbYesNo, "Password Error") = vbYes Then
GoTo Retry
End If
End If
Exit_ALLOWEDITBUTTONS_Click:
Exit Sub
Err_ALLOWEDITBUTTONS_Click:
MsgBox Err.Description
Resume Exit_ALLOWEDITBUTTONS_Click
End Sub
The issue i am having is that if the correct password is entered the first time then the record is still locked for editing and deletion.
You physically have to enter an incorrect password and then click retry and enter the correct password for it to unlock the record.
Can anyone see what I have wrong in my code that would be causing the issue or having to enter an incorrect and then the correct password for it to work?
Also on an other note you will see the password is set to ACCOUNTS when entered into the input field it is incorrect, for some reason it is only picking up ACCOUNT (with out the S) as the correct password, missing out the last character happens for any word I set as the password.
Any thoughts on that?
Thank you in advance
Adam