List of updated fields

G

GregW

I have a change history log that tracks the user name,
date, and record anytime a record is changed. I have this
tied to the form's AfterUpdate property. Is there any way
to retrieve a list of the fields that were updated and put
them in one field of my history table?
 
D

Dirk Goldgar

GregW said:
I have a change history log that tracks the user name,
date, and record anytime a record is changed. I have this
tied to the form's AfterUpdate property. Is there any way
to retrieve a list of the fields that were updated and put
them in one field of my history table?

In the form's BeforeUpdate event, you could loop throught the bound
controls on the form and compare each control's Value property with its
OldValue property. When the properties are not equal (and are not both
Null), then the control has been updated. I think you'd want to store
the list of updated fields in a module-level variable so that you can
pick it up in the AfterUpdate event.
 
D

Dev Ashish

Is there any way
to retrieve a list of the fields that were updated and put
them in one field of my history table?

Not directly, I don't think. But you can use the form's BeforeUpdate event
and compare a control's 'OldValue' with 'Text' value and see if there're
any changes and build a list this way. You might need to set focus on
individual editable controls to get to the uncommitted value.

-- Dev
 
D

Dirk Goldgar

Dev Ashish said:
Not directly, I don't think. But you can use the form's BeforeUpdate
event and compare a control's 'OldValue' with 'Text' value and see if
there're any changes and build a list this way. You might need to
set focus on individual editable controls to get to the uncommitted
value.

Dev -

Can there be an uncommitted value in the form's BeforeUpdate event?
 
D

Dev Ashish

Can there be an uncommitted value in the form's BeforeUpdate event?

Oops, I should've realized. All the values would be uncommitted in
BeforeUpdate, right?

Thanks
-- Dev
 
D

Dirk Goldgar

Dev Ashish said:
Oops, I should've realized. All the values would be uncommitted in
BeforeUpdate, right?

I'm pretty sure all values would be committed already in
Form_BeforeUpdate.
 

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