Update from 1 field to another in same table

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

This may seem like a very easy question, but it's got me
stumped. I want to update a field called OldMaster with
information from a field called MasterID. Both fields are
in the same table called Communication. This update
occurs before the MasterID is changed to a new MasterID
number by a user. Perhaps I am thinking too complicated
hard about this and making it more complicated than it
really is, but I can't seem to figure this one out.
Thanks in advance
..
 
Eric,

Interesting what you are trying to do. I hope that changing
a 'MasterID' won't orphan a lot of child records in your
related tables.

If you want this to be very easy on the user you could use
the OldValue property to poke into the OldMaster field when
someone changes the MasterID. My cautious nature would
probably force the user to hit a button or answer a dialog
box to confirm the change. Here is the easy way using the
MasterID AfterUpdate and double checking that it has been
changed...

Sub MasterID_AfterUpdate()

If Me!MasterID <> Me!MasterID.OldValue
Me!OldMaster = MasterID.OldValue
End If

End Sub
 
Back
Top