This sounds just like a fantastic bit of code that I picked up on the
internet.
Would love to give the author a plug.
If a nutshell all you require is to set the tag properties of any field
in any form that you want to keep an audit trail for. Then you can
display a filter view in your subform.
This the before update property to check what's changed and save it.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim rs1 As Recordset, ctrl As Control
If Me.Dirty = True Then
Set rs1 = CurrentDb.OpenRecordset("tblAudit", dbOpenDynaset)
For Each ctrl In Me
If ctrl.Tag = "Audit" Then
If ctrl.OldValue <> ctrl.Value Then
rs1.AddNew
rs1![Form_Name] = Me.Name
rs1![Record_ID] = Me![EmployeeID]
rs1![Field_Altered] = ctrl.Name
rs1![DateTime_Altered] = Now
rs1![Altered_By] = CurrentUser()
rs1![From] = ctrl.OldValue
rs1![To] = ctrl.Value
rs1.Update
End If
End If
Next ctrl
rs1.Close
End If
End Sub
Hope this helps.
Tom Bizannes
Microsoft Certified Professional
Sydney Australia
Http://www.smartbiz.com.au
I have a form with name, nursing home, funding status etc. I need to do
an
audit trail when they leave a nursing home or when they are council
funded
then they become self funding. I need a history in a datasheet
subform -
how do I do this, I tried in a subform but it doesn't pick up when they
have
left a nursing home.
Thanks
Elaine