Deleted record, need audit trail w/userid

HAFPT

Registered User.
Local time
Today, 16:36
Joined
Oct 30, 2003
Messages
23
I have a form that allows the users to Search to find Leter of Credit records already entered into the DB. From this from they have a button to delete these record too.

I want to add in an audit trail to the delete function so I the Admin knows what Letter of Credit records were delete but more importantly by which user.

Here is the Event code I have for the button to delete all references to the given record.
________________________________________________
Private Sub DeleteLC_Click()

DoCmd.OpenQuery "DeleteLCDocHist"
DoCmd.OpenQuery "ClearLCFromShipment"
DoCmd.OpenQuery "DeleteLC"
Me.Requery

End Sub
_________________________________________________

My thoughts were to add in an Update Query as the first query to save this record off to an audit file but I can't figure out how to get the UserID part of the audit file record in the Query.
 
Create a DELETE table with fields user name, date of deletion, and all the data deleted ( one per field or you can create a memo field that would keep the whole record - (Name = Smith, Amount = 22,etc)

Before you run the delete querry, append it first to the table.

For the username function, search this site - "Get the username".
 
CurrentUser() will give you the users workgroup name if you are using Access security with workgroups. If not you will get the default which is "Admin" since all databases are technically secured.

The Environ() function will let you grab the users network name & their computer name. Seach the forum for "Environ" and you will find lots of examples. Add my user name "ghudson" for a refined search.

I also suggest that you do not delete the records from the table. Add a new field to your table named "Deleted" and mark those records with a yes or -1 and then base your query to either show or hide the records if the value in the Deleted field is true/yes/-1.
 
Thanks for the additional ideas and code

I was just looking at your AuditTrail example
 

Users who are viewing this thread

Back
Top Bottom