Are you storing the old values in the table? I had to do that for one for
one of my dbs also. I added the "old" fields to my table
and added code to the form to update those with the old value before the
values were changed. That way I could run the report a
ny time showing what the values were and what they are now. You can also
create a database somewhere else on your server and write the new values and
old values to it.
For example...
I use the following code in the AfterUpdate event for the fields I need to
know the old value for.
Dim db As Database
Dim audit As Recordset
Dim temp As Integer
Set db = OpenDatabase("L:\Claims\audit.accdb")
Set audit = db.OpenRecordset("YourAuditTableName")
temp = WriteAuditTrail(audit, Field.NAME)
Function WriteAuditTrail(rst As Recordset, fn As String) As Integer
On Error GoTo ErrorHandler
' Edit the current record in the recordset.
If Me(fn).OldValue() <> "" Then
rst.AddNew
rst!UserModified = CurrentUser()
rst!ClaimNumber = Forms![frmRCAClaims]![1#_CLM#]
rst!FormModified = Me.NAME
rst!fieldmodified = fn
rst!DateTimeModified = Now
rst!OldValue = Me(fn).OldValue()
rst!NewValue = Me(fn)
rst.Update
Me.Refresh
End If
ErrorHandler:
Select Case Err
Case 0
' conSuccess is defined at the module level as a public constant
' of type Integer with a value of zero.
WriteAuditTrail = conSuccess
Exit Function
Case Else
MsgBox "Error " & Err & ": " & Error, vbOKOnly, "ERROR"
WriteAuditTrail = Err
Exit Function
End Select
End Function
Hope that helps...good luck!
news:395dfcdf-aaa9-44e8-80a8-77b0847ec95e@y21g2000hsf.googlegroups.com...
Hello,
I have been asked to create a report that shows items that have been
changed after running an update query. What my higher-ups would like
is a report that would show the old value of the field and the new
value of the field. Do tables have a .OldValue property like forms?
If so, how would I access that information to fill the report?