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

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
Back
Top