View Single Post
  #2  
Old January 9th, 2008, 04:06 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default locking a field in a form

Yes, use the form's Current event:

With Me
If .NewRecord Then
.txtSomeControl.Enabled = True
.txtSomeControl.Locked = False
ElseIf IsNull(.txtSomeControl) Then
.txtSomeControl.Enabled = True
.txtSomeControl.Locked = False
Else
.txtSomeControl.Enabled = False
.txtSomeControl.Locked = True
End If
End With

It will unlock the control for new records and for existing records where no
entry has been made and Lock it for exiting records where a value exits.
--
Dave Hargis, Microsoft Access MVP


"Debbie S." wrote:

Hello,

I want to be able to lock a field but still allow the user to enter NEW data
into the field in the form. (In other words, allow users to enter new data
into a particular field of a form but not change existing data in that
field). If I lock the field in the properties sheet, the data can't be
edited, which is good, but you can't enter new data either, which defeats the
purpose of the form. Is there a way to do this?

Thanks,
Debbie