Locking a record.

  • Thread starter Thread starter Bill Davis
  • Start date Start date
B

Bill Davis

I have database that is used for tracking jobs progress.
I want to stop a record from being edited once the
completions date has been entered with a message box that
gives a warning.. I hope someone can help
Thank you
Bill
 
In Access 2000 and later, you can simply cancel the form's Dirty event to
prevent changes if the completion date is not null.

In earlier versions, or to prevent the user even getting that far, you could
use the form's Current event set its AllowEdits and AllowDeletions, or (if
you have unbound controls that the user needs to be able to modify) to loop
through the controls and set their Locked property. Post a reply to this
thread if you need an example of how to do that.
 
Allen,
I would appreciate if you could give me a sample of using
the Dirty event for I am not familiar with using that
event.
Thanks Bill
 
1. Set the form's On Dirty property to:
[Event Procedure]

2. Click the Build button (...) beside this. Access opens the code window.

3. Between the "Private Sub..." and "End Sub" lines, enter something like
this:

If Not IsNull(Me.[Completion Date]) then
Cancel = True
MsgBox "No changes permitted"
End If
 
Back
Top