lock individual fields in access form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to be able to lock individual fields in a form when the field contains
data. Obviously when creating a new record I need to be able to enter data in
the field. I can lock the whole record and I can lock the field at the
moment but it then does not allow me to enter data in new records
 
You can do this easily using the form Current event.

Dim blnUnlockControl

blnUnlockControl = Not Me.NewRecord

Me.txtSomeControl.Locked = bnlUnlockControl
Me.txtAnotherContro.Locked = blnUnlockControl

Now, the other thing is when you want to lock the control with data. If you
want to leave it editiable until the record is inserted in the table, then
you may not need any other code unless the record remains the current record.
If that is the case, you can lock the controls in the After Insert event.
 
Back
Top