Lock a text field after an update - Access 2002

  • Thread starter Thread starter guaj1818
  • Start date Start date
G

guaj1818

Hi,

I am using Microsoft Access 2002 and I have two text fields in my form
called NetID and CustomerID. Is there a way to have both the text fields locked
after the user enters a netid and customerid for the first time after
a new post is created? I don't want the user to be able to modify or
delete any of the text fields after the first input.

Any help would be highly appreciated. Thanks in advance.
 
guaj1818 said:
I am using Microsoft Access 2002 and I have two text fields in my form
called NetID and CustomerID. Is there a way to have both the text fields locked
after the user enters a netid and customerid for the first time after
a new post is created? I don't want the user to be able to modify or
delete any of the text fields after the first input.


Add a procedure like the following to the form's module.

Private Sub SetLock()
Dim bolLock As Boolean
bolLock = Not (IsNull(Me.NetID) Or IsNull(Me.CustomerID))
Me.NetID.Locked = bolLock
Me.CustomerID.Locked = bolLock
End Sub

Then call the procedure from the form's current event and
both text box's AfterUpdate event:
 
Back
Top