How To Get "Before" and "After" Values for a Field in "BeforeUpdate"Event

H

HumanJHawkins

When a user changes a status field in my database, I would like to
auto-generate a note that says something like "Date - User: Status
changed from X to Y."

I am attempting to do this via the BeforeUpdate event. But I notice
that before this event fires, the data is already changed in the form.
Is the value of the field before the change happened still in the
local data somewhere. I would like to avoid adding another transaction
with the database server just for this.

Thanks in advance.
 
B

Banana

Look at the property OldValue and Value for the Before and After value,
respectively.

There's also Text property but that's only relevant for OnChange event.
 
D

David W. Fenton

Banana said:
Look at the property OldValue and Value for the Before and After
value, respectively.

....while the OldValue property is available at any time, it's only
useful when the control has the focus, since the only time it's
intentical to the Value property is before the control's AfterUpdate
event.
There's also Text property but that's only relevant for OnChange
event.

Er, what? The Text property is available in any event, as long as
the control has the focus.
 
M

Marshall Barton

David said:
...while the OldValue property is available at any time, it's only
useful when the control has the focus, since the only time it's
intentical to the Value property is before the control's AfterUpdate
event.


The OldValue property is useful until the **form**
AfterUpdate event. It should always contain the value of
the control's bound field in the record source table.
 
B

Banana

David said:
Er, what? The Text property is available in any event, as long as
the control has the focus.

I didn't say it wasn't available; I said it was only relevant (e.g. it's
of practical use) in OnChange event, not so much in other events
especially when the Value doesn't require a focus.

I imagine there may exist a case of using Text in different event, but
that would be very rare.
 

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