About a month ago I put together a database with an audit trail. It is a database of equipment that gets edited from time to time through Equipment Change Requests (ECR's) via a form I designed. I thought everything was fine & dandy until I went to run a custom query/report on ECR # 12 to see its effect on the overall budget. Then I realized that my audit trail - which has been tracking for a month now, about 1,000 changes already - may have a defect.
The database itself stores the current ECR_No, Reason_for_Change, and Ext_Cost.
The form that changes are made through (attached) prompts through VBA a separate table called tblDatabaseChanges to record the following:
There have since been further ECR's completed, so I'll have a record where the ECR No. is for example 15 and so ECR 12 gets pushed into the old value field and wouldn't be found by the query/report. And from the looks of it, once a 3rd ECR is entered for the same equipment item, the old values and changes are eventually overwritten.
How can I salvage this audit trail? Please help....this was the result of SO much work and I'm now brick wall*forehead
What I would love is for the form - which cycles all the records in the database - to not cycle the fields ECR_No, Last_Edited_by, and Reason_for_Change, and instead write the records into tblDatabaseChanges and when you go back to that record via the form those fields only remain fresh & blank for each item. Without, if possible, creating a whole new dilemma with the existing audit trail info.
The database itself stores the current ECR_No, Reason_for_Change, and Ext_Cost.
The form that changes are made through (attached) prompts through VBA a separate table called tblDatabaseChanges to record the following:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblDatabaseChanges")
With rs
.AddNew
.Fields("RecordID") = Me.RecordID
.Fields("Project_Name_Old") = Me.ctlProjectName.OldValue
.Fields("Major_Dept_Old") = Me.ctlMajorDept.OldValue
.Fields("Dept_Name_Old") = Me.ctlDeptName.OldValue
.Fields("Room_Name_Old") = Me.ctlRoomName.OldValue
.Fields("Room_No_Old") = Me.ctlRoomNo.OldValue
.Fields("Item_Qty_Old") = Me.ctlItemQty.OldValue
.Fields("Unit_Cost_Old") = Me.ctlUnitCost.OldValue
.Fields("Ext_Cost_Old") = Me.ctlExtCost.OldValue
.Fields("Manufacturer_Old") = Me.ctlManufacturer.OldValue
.Fields("Model_Old") = Me.ctlModel.OldValue
.Fields("Phase_Old") = Me.ctlPhase.OldValue
.Fields("ECR_No_Old") = Me.ctlECRNo.OldValue
.Fields("CAD_ID_Old") = Me.ctlCADID.OldValue
.Fields("Description_Old") = Me.ctlDescription.OldValue
.Fields("Type_Funding_Old") = Me.ctlTypeFunding.OldValue
.Fields("FI_Old") = Me.ctlFI.OldValue
.Fields("AC_Old") = Me.ctlAC.OldValue
.Fields("Last_Edited_by_Old") = Me.ctlLastEditedBy
.Fields("Reason_for_Change_Old") = Me.ctlReasonForChange
.Fields("Budget_Variance") = Me.ctlExtCost.OldValue - Me.ctlExtCost
.Update
.Close
End With
Set db = Nothing
Set rs = Nothing
End Sub
There have since been further ECR's completed, so I'll have a record where the ECR No. is for example 15 and so ECR 12 gets pushed into the old value field and wouldn't be found by the query/report. And from the looks of it, once a 3rd ECR is entered for the same equipment item, the old values and changes are eventually overwritten.
How can I salvage this audit trail? Please help....this was the result of SO much work and I'm now brick wall*forehead
What I would love is for the form - which cycles all the records in the database - to not cycle the fields ECR_No, Last_Edited_by, and Reason_for_Change, and instead write the records into tblDatabaseChanges and when you go back to that record via the form those fields only remain fresh & blank for each item. Without, if possible, creating a whole new dilemma with the existing audit trail info.