Audit trail

  • Thread starter Thread starter Graham
  • Start date Start date
G

Graham

Is there a way to record all the fields of a record that
a user wants to delete through a form. I want to record
additions deletions for an audit trail.
 
Yes, you can. Depending on if you are using bound or unbound forms, this
can be a difference of which event you would use, like on bound forms, you
may use the BeforeUpdate Event while on unbound forms, you may have it
record about the same time (just before or just after the
addition/deletion).

In the following scenerio, I am assuming you have a minimal of 1 BE DB,
which is where all of your data is located at, and you have 1 FE DB which
has all of your other objects and your customers use to interface with the
BE DB(s)

In one of your BE DB, setup a table just how you want it for logging
purposes

In your form in the FE DB, setup the code using either ADO or DAO to record
the logable event. When declaring your ADO/DAO objects, be sure to have the
needed references checked and prequalify your objects as you can use both
ADO and DAO in your code at the same time.

I'm also currently working on a project, which involves a minimal of 3 BE
DBs and given the data validation check requirements that I am using, bound
forms has proven to be UNusable for me, namely cause of how the events works
and given that, it makes the forms not so user friendly for the mouse users.
 
It can be done, but involves some effort.

When the form's Delete event fires, you have access to the record being
deleted, but you don't know if the deletion will be cancelled. When the
BeforeDelConfirm or AfterDelConfirm fires, you know whether the deletion
will complete, but you no longer have access to the record being deleted,
and in fact there may be multiple records being deleted (e.g. in a datasheet
or continuous form). The solution therefore involves writing the record(s)
to a temporary table in the Delete event, and then completing the task in
the AfterDelConfirm event.

Details in article:
Audit Trail - Log changes at the record level
at:
http://allenbrowne.com/AppAudit.html
 
Back
Top