Creating Tracking system

message from =?Utf-8?B?MXRpbWU=?= on 27 May 2004
I'm trying to find a way how to tracked changes in Access. What I'm trying to do is when a person signs is using a login name, can Access record any changes that make in Access.
thanks
 
Jim/Chris replied to =?Utf-8?B?MXRpbWU=?= on 27 May 2004
Here is a previous post from Arvin Meyer.

access? Does anyone know how to do this?

Yes. In the before update event of the form, grab the
OldValue property of each control and insert that value
into an audit table, together with the date\time of the
record change, and the username of the person doing it.
Here's one sample (aircode):

Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_Handler

Dim lngItemID As Long
Dim strContractorID As String
Dim strSubdivision As String
Dim lngModelID As Long
Dim dblCost As Double
Dim dblCostCode As Double
Dim dtmEffectiveDate As Date
Dim db As DAO.Database
Dim strSQL As String

lngItemID = Me.txtItemID.OldValue
strContractorID = Me.txtContractorID.OldValue
strSubdivision = Me.txtSubdivision.OldValue
lngModelID = Me.txtModelID.OldValue
dblCost = Me.txtCost.OldValue
dblCostCode = Me.txtCostCode.OldValue
dtmEffectiveDate = Me.txtEffectiveDate.OldValue

Set db = CurrentDb

Me.txtLastUpdated = Now

strSQL = "INSERT INTO tblItemHistory ( ItemID,
Subdivision, ModelID,
CostCode, Cost, ContractorID, EffectiveDate )"
strSQL = strSQL & " VALUES (" & lngItemID & ", '" &
strSubdivision & "',
" & lngModelID & ", " & dblCostCode & ", " & dblCost & ", '" &
strContractorID & "', '" & dtmEffectiveDate & "');"
db.Execute strSQL

Exit_Here:
Exit Sub

Err_Handler:
MsgBox Error$
Me.Undo
Resume Exit_Here

End Sub

Jim

What I'm trying to do is when a person signs is using a
login name, can Access record any changes that make in Access.
 
Tony Toews replied to =?Utf-8?B?MXRpbWU=?= on 27 May 2004
There's a simple example at
ACC2000: How to Create an Audit Trail of Record Changes in a Form
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q197592

Audit Trail - Log changes at the record level at:
http://users.bigpond.net.au/abrowne1/AppAudit.html
The article addresses edits, inserts, and deletes for a form and
subform.

Modules: Maintain a history of changes
http://www.mvps.org/access/modules/mdl0021.htm
The History Table routine is designed to write history records that
track the changes made to fields in one or more tables.

Tony
 

Archived message: Creating Tracking system (Microsoft Access)