set flag value if any fields in record change

  • Thread starter Thread starter PC
  • Start date Start date
P

PC

I have a form which contains fields with existing data that users can update.
If changes are made to any of the fields I would like to set a
"Record_Has_Changed_Flag" to Y. The form's source is a query and the changed
record flag field is in the underlying table.

Ultimately, I need to identify records that have changed and export them to
another application.
 
PC said:
I have a form which contains fields with existing data that users can
update.
If changes are made to any of the fields I would like to set a
"Record_Has_Changed_Flag" to Y. The form's source is a query and the
changed
record flag field is in the underlying table.

Ultimately, I need to identify records that have changed and export them
to
another application.


You could use the form's BeforeUpdate event to set the flag field:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me.Record_Has_Changed_Flag = True
' or set the value to "Y", if it's a text field

End Sub

Presumably you'd have code in the export process to reset all the flags
after the export.

Alternatively, it may be more useful to have a LastModified date/time field,
and update that when the record is updated:

Me.LastModified = Now()
 
Allen Browne has a good example auditing...

http://allenbrowne.com/AppAudit.html

This is more than just casual, it may be a little more than you really need
(the beforeupdate event works fine for a lot of people's cases), but if you
really want to get picky about making sure that every single change gets
logged within the best ability of Access to do it, this a good one to check
out.


--
Jack Leach
www.tristatemachine.com

- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain
 
Back
Top