Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing log.txt file to know changes during updates

Status
Not open for further replies.

GIJoeFigure

Technical User
Jun 16, 2004
27
0
0
US
I have been trying to find a way to list the records in my recordset that are being deleted when it updates and also list the records that are added new. I wanted to just put in a couple of lines of code so when the file is deleted or added new, the program would record it and output a log. Does anybody have any experience with anything like that?

Joe

 
Have you thought of adding a "Record_Change_Log" table to your database instead of writing to a text file?

Of course the issue becomes, how do you write diverse data records to the Record_Change_Log table. Perhaps the easiest method would be to have the following:

Record_Change_Log Table:
LogEntryID AutoIncrement Unique Log Entry ID
LogEntryTimeStamp Date TimeStamp of Change
TableName Text Obviously the table
modified
Action_ID Numeric (Long) Foreign Key to
Record_Action table
Original_Record Memo
Altered_Record Memo
Modified_By (????) User ID Link for User
that made the change

Record_Action Table:
Action Text Human Consumable Action
name (e.g. Insert,
Delete, etc.)
Action_ID AutoIncrement Unique Record Action ID


The bad news is that it is going to take a bit more than "just . . . a couple of lines of code" because you are going to have to record all of the information in a retrievable format, e.g. XML, for the actual record data.

The good news is you are faced with the same problem if you use a text file because you are once again going to have to record the information in a retrievable format.

The really bad news is that what you are saying you want to do requires a somewhat radical re-thinking of the over all design of your database. To accomplish the task you seem to want to accomplish means that all of your data entry is going to have to be done using some sort of "entry transaction file" approach.. That means that you will have to have a parallel set of tables that allow you to enter, for example, new employee records, employee records to be deleted, or updates to employee records and then process those entries to perform the actual insertions, deletions, or updates by means of a lot more than "just . . . a couple of lines of code".

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top