on open property

J

JOYCE O

We actually will be updating dozens of cases a day. I
want to retain both values, CaseType and PreviousCaseType
in my table. Can I do this with code, I'm just not sure.
Thanks
-----Original Message-----
How many revisions do you want to track? If it is just the last one and you
are using a form, then in the form's BeforeUpdate event, set
PreviousCaseType to the OldValue property of CaseType. You would need to
verify that the OldValue property actually contains a value before assigning
it since that may no be the reason the form is updating (another field may
have been changed). This could also be done in the AfterUpdate event of
CaseType, but you'd have to remember to Undo it if the change to CaseType
was undone.

--
Wayne Morgan
MS Access MVP





.
..
 
R

Rick B

You would need to include a command on the before update.

Assuming you only want to track the most recent change, test to see if the
case type has been changed. If so, put the old value in the Previous field.
Make sure to give 'null' a value because you will get errors if you try to
compare a null value to a value...




Private Sub Form_BeforeUpdate(Cancel As Integer)
If (Nz(CaseType.OldValue, 0) <> Nz(CaseType.Value, 0)) Then
PreviousCaseType = CaseType.OldValue
End If
End Sub


Hope that helps,

Rick


We actually will be updating dozens of cases a day. I
want to retain both values, CaseType and PreviousCaseType
in my table. Can I do this with code, I'm just not sure.
Thanks
-----Original Message-----
How many revisions do you want to track? If it is just the last one and you
are using a form, then in the form's BeforeUpdate event, set
PreviousCaseType to the OldValue property of CaseType. You would need to
verify that the OldValue property actually contains a value before assigning
it since that may no be the reason the form is updating (another field may
have been changed). This could also be done in the AfterUpdate event of
CaseType, but you'd have to remember to Undo it if the change to CaseType
was undone.

--
Wayne Morgan
MS Access MVP





.
..
 

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