take action when any field is changed

J

Jeri

Hello all;

I have an Access 07 database and a form with lots of fields. In the past I
added code on each field so that if somebody made a change, their login name
would be entered in a field on the form. This method has allowed me to save a
client in the past who realized that for nearly a year he and an assistant
had been working on different files. Yikes.

The code itself is very simple

Me.ChangedLogin = Forms!frm_Login!Login_Variable
Me.Changed = Date

But I've been trying to figure out if there is a way to have this code run
when any field on a form is changed, rather than applying an "after update"
code to each field individually. I've tried several options, including "on
data change" but it didn't work. I would deeply appreciate any ideas you
might have.

Jeri, editing many spider records in Flagstaff Arizona
 
J

Jeff Boyce

Are you saying that if anything changes in the record (via the form), you
want to know who?

Check the Me.Dirty property ... you could use it in the Form's BeforeUpdate
event.

Regards

Jeff Boyce
Microsoft Access MVP
 
J

John W. Vinson

Hello all;

I have an Access 07 database and a form with lots of fields. In the past I
added code on each field so that if somebody made a change, their login name
would be entered in a field on the form. This method has allowed me to save a
client in the past who realized that for nearly a year he and an assistant
had been working on different files. Yikes.

The code itself is very simple

Me.ChangedLogin = Forms!frm_Login!Login_Variable
Me.Changed = Date

But I've been trying to figure out if there is a way to have this code run
when any field on a form is changed, rather than applying an "after update"
code to each field individually. I've tried several options, including "on
data change" but it didn't work. I would deeply appreciate any ideas you
might have.

Jeri, editing many spider records in Flagstaff Arizona

I'd suggest using the Form's BeforeUpdate event. It fires if the user has
changed any field on the form.

The disadvantage would be that the user could make a change, undo that change
(leaving the form dirty but the data actually unchanged), and leave an
unneeded log entry.
 

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