prefill and lock

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?
 
T

tina

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
 

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