Lock a record after a field has been updated

susanmgarrett

Registered User.
Local time
Today, 00:11
Joined
Dec 7, 2004
Messages
41
I have a simple database - no links - that uses a form for record entry and look-up. I would like to prevent the fields in a single record from being updated or changed after a particular field (completeddate) has been entered (i.e. is not null). Once that completed date field has been entered, I don't want any user able to change the data in that record, but I do want it available for look-up, sort, and review.

Is there a way to gray-out the data for a locked record? And how would I go about this?

I also want to thank everyone in this group for their assistance. I haven't had any formal access training and literally have had to train myself on a project-by-project basis. Your help has not only been invaluable but educational as well!
 
Lock records

In the After Update Event of the field Completeddate you can put this code:

If IsNull(Me.Completeddate) = False Then
Me.yourfield.Enabled = False
Else
End If

It will lock yourfield after update of the CompletedDate field.
Of course you can lock as many field as you want simply by adding a line of code.

At some point you may need to enable the fields again, in case of an error in the data or a change.

You can simply put this code behind a command button:
Me.yourfield.Enabled = True
 

Users who are viewing this thread

Back
Top Bottom