lock individual fields in access form

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
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top