prefill and lock

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

I have a field for "Item". When the data is entered in the
item field, I also want it to prefill in
the "PreviousItem" field. I want to be able to edit the
item field, but not edit the PreviousItem field. Can this
be done with code?
 
Private Sub Item_AfterUpdate()

Me!PreviousItem = Me!Item
Me!PreviousItem.Locked = True

End Sub

the code above is very simple - it will run every time Item is updated,
period. and while it will lock PreviousItem, it will never *unlock* it. if
you want a specific action to take place under specific circumstances, you
have to write specific code for it. suggest you ask yourself the following
types of questions:
is this for new records only, or do i want the value updated in existing
records also?
is the PreviousItem *ever* allowed to be updated manually? if so, under what
circumstances?
if the Item value is changed *at any time*, should the PreviousItem be
changed also? or not?

hth
 
Back
Top