How do I unlock a field on a form ONLY when adding a new record?

G

Guest

I have a form which has several fields locked (data that would not normally
change). But I want the fields to automatically be unlocked when adding a
new record. I have a macro which can lock/unlock the fields via a button on
the form, but I can't get the macro to kick off automatically on a new
record. I have tried assigning the macro to the "Befiore Insert" in the form
properties, but it doesn't seem to be running.

Any ideas?

Thanks.
 
G

Guest

To the OnCurrent event of the form you can write code that check if the
record is new and unlock the field

If Me.NewRecord Then
Me.FieldName.Locked = False
Else
Me.Fieldname.Locked = True
End If
 

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