Lock record

Leo_Polla_Psemata

Registered User.
Local time
Today, 07:35
Joined
Mar 24, 2014
Messages
364
The below code, performs the required action,
If i click on the yes/no field 'lockrec', the record gets locked, however,
if i close and reopen the form, then form edit is allowed.

How could i make it so the record remains locked.
Code:
Private Sub LockRec_Click()

    If Me.lockrec = True Then
        Me.AllowEdits = False
    Else
        Me.AllowEdits = True
    End If

End Sub
 
use current event of your form:

private sub form_current()
call LockRec_Click
end sub
 
use current event of your form:

private sub form_current()
call LockRec_Click
end sub
I made it.
Is there any way we could leave only "lockrec" key unlocked?
Because, once i lock the record, this protects from accidental edits, then i might need to unlock but now only on table level i could do it.
 
The below code, performs the required action,
If i click on the yes/no field 'lockrec', the record gets locked, however,
if i close and reopen the form, then form edit is allowed.

How could i make it so the record remains locked.
Code:
Private Sub LockRec_Click()

    If Me.lockrec = True Then
        Me.AllowEdits = False
    Else
        Me.AllowEdits = True
    End If

End Sub
Think about it?
How is Access meant to know you want that record locked?

Either LockRec must be bound or some other field is populated, perhaps DateCompleted?
Either way, you must tell Access how it can determine whether the record should be locked or not.
 

Users who are viewing this thread

Back
Top Bottom