Protecting a field on a form

mrssevans

Registered User.
Local time
Today, 13:03
Joined
Nov 15, 2001
Messages
190
I have one field that I need to disallow users to change. Here is the code that I am using, but it if I put it after Change() then I can't enter new stuff and if I put it AfterUpdate() it won't stop them from changing it. Any suggestions?

Private Sub Notes_BeforeUpdate(Cancel As Integer)
If Me.Consultant Is Not Null Then
MsgBox "You cannot change the data in this field. Please ask your administrator to change this data for you."
SendKeys "{ESC}", True
End If
End Sub
 
Private Sub Notes_BeforeUpdate(Cancel As Integer)
If IsNull(Me.Consultant) Then
Exit Sub
MsgBox "You cannot change the data in this field. Please ask your administrator to change this data for you."
Me.Undo
End If
End Sub
 
That is not working for me. I am needing it to say if it is not null then perform those functions to undo the change. Any suggestions?
 
Can't you just change the Locked property for that form control to "yes"???? If it is a calculated field, it will still calcualte, it simply locks out manual entry.
 

Users who are viewing this thread

Back
Top Bottom