Track changes by users

cbialzik

Registered User.
Local time
Today, 15:02
Joined
Feb 21, 2006
Messages
15
What is the simplest way to track who is making a change to a record and when they made the change? I've tried searching for help but I'm not quite grasping how to do this. Any ideas?
 
Do a search for Audit Trail. Plenty of stuff in these forums.
 
I don't want to do an Audit Trail really. I just want to know who made a change,when and to what record. I don't need to track the changes to the record. I can't seem to find anything that will give me a basic step by step of how to do this.
 
cbialzik said:
I don't want to do an Audit Trail really. I just want to know who made a change,when and to what record. I don't need to track the changes to the record. I can't seem to find anything that will give me a basic step by step of how to do this.
How is that not an "audit trail"? You can modify my Audit Trail by removing the code that stores the changes to the record and record the information that you want.
 
Or to really simplify things you could add two new fields to your table [ModifiedBy] & [ModifiedDate] and use the BeforeUpdate event of your form to populate those "hidden" fields with the users network name and the current date/time. But that will not give you any history, only the last person to modify the record.

Search around for the answers to your question are all over this forum.
 
Thanks for the help. I do really just want to know who modified it last. I've tried searching the forums but haven't found anything that is clear enough. I don't write code much anymore so I'm just having a tough time understanding some of what is out there. I have the 2 fields added to my table, I just don't know how to pull the date and username in.
 
OK, I got the date to go into the table by putting lastupdated=now() in the beforeupdate event procedure. How do I capture the username to put in my updateby field?
Thanks for bearing with me!
 
Code:
ModifiedBy = Environ("UserName")
Search around for there is more info you can get using the Environ function like...
Code:
Environ("ComputerName")
 
AuditTrail and MouseTrap Problems

I have a tabbed form that I applied GHudson's AuditTrail code to and it works well.

I have another tabbed form that I applied GHudson's MouseTrap code to and it works well.

Now I need to have both sets of code on the same tabbed form, and it doesn't work so well.

It is writing the changes the user makes into the AuditTrail, but it appears that the MouseTrap isn't working because I get a VBA error "Run-time error '13': Type mismatch" when I click any of the Mousetrap enabled buttons.

When I select "Debug", the offending line of code is in red below:

----------
Err_bSave_Click:
If Err = 2046 Then 'The command or action Undo is not available now
Exit Sub
Else
MsgBox Err.Number, Err.Description
Resume Exit_bSave_Click
End If

End Sub
----------

GHudson, or anyone, please help.
 
Try this...

Code:
Exit_bSave_Click:
    Exit Sub

Err_bSave_Click:
    If Err[COLOR="RoyalBlue"].Number[/COLOR] = 2046 Then  'The command or action Undo is not available now
        Exit Sub
    Else
        MsgBox [COLOR="royalblue"]Err.Number & " - " & Err.Description[/COLOR]
        Resume Exit_bSave_Click
    End If
    
End Sub
 
Thanks you for the quick reply, GHudson.

I applied your new code and this is what happens:

Click "Save": Error 2110: Microsoft Office Access can't move the focus to the control tbHidden.

Click "Undo": Run-time error '13': type mismatch.

Click "Close": Run-time error '13': type mismatch.

During this testing phase, I have re-enabled the Control Box and Close Button. I even get the same run-time error when using the close Box.
 
Does your form have the "tbHidden" textbox? If not, remove that line of code.
 
GHudson,

Yes, it does have the tbHidden text box.

Randy
 
Without seeing your db I could not even guess where the problem is. Back track and ensure your code and objects mirror my example.
 

Users who are viewing this thread

Back
Top Bottom