Jose Quervo
Jose Quervo

Reputation: 175

VB6 Audit Trail

was wondering if anyone had any insight on creating an audit trail process in VB6?

I have an application that gets populated with existing data with the use of 3 or 4 classes. The user can then modify any data they wish on this application. Then the data is saved into tables used for a queue. Basically exact copies of the tables the data came from. My problem is I need to create an audit trail.

What is the best practice for this? Compare every control (text box, radio, check box) on the application which is around 100? Or can I utilize the text_changed event of the text boxes? Really have no idea where to start on this one.

Oh and to make it fun, using a Pervasive DB v9.

Thanks for any help.

Cheers

Upvotes: 0

Views: 702

Answers (1)

jmoreno
jmoreno

Reputation: 13571

This should always be done inside the DB.

Something like this (cribbed in part from post to the pervasive forum, I haven't actually used Pervasive):

create trigger insTrig
before insert on table1
referencing new as new_rec
for each row
insert into table2 values (new_rec.co1,new_rec.col2,new_rec.col3,...)#

create trigger delTrig
before delete on table1
referencing old as new_rec
for each row
insert into table2 values (new_rec.co1,new_rec.col2,new_rec.col3,...)#

create trigger updTrig
after update on table1
referencing new as new_rec
for each row
insert into table2 values (new_rec.co1,new_rec.col2,new_rec.col3,...)#

Upvotes: 1

Related Questions