Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logging User activity

Status
Not open for further replies.

jnp102

Technical User
Mar 22, 2004
19
0
0
US
Hi all,

Had a question about grabbing the workstation logon ID and 1, putting it with a time stamp in a table and then 2, using it to track what changes have been made to the data.

Currently my database opens to a form where people can enter/edit data. This form also pulls the workstation id and puts it in a hidden text field (unbound). I would like to do a "onload" command to put a record in another table (loginhist) of the workstation ID and the time/date stamp that opened it that form. Then once in the form I would like to track that workstation ID's activity (with time/date stamp again). I would like to put this type of info into a table that registers workstation ID, Time/Date, Old Value and New Value.

Unfortunately I have tried Access security but it is now what I am looking for for several reasons. Thus the reason I want to use the workstation ID (which I already have set up).

Not sure if this can happen and if it can not sure where to start. Any leads, answers or alternate ideas would be greatly appreciated.

Thanks
jnp102
 
Here is 1 approach that I've used in the past...

Create a tblLog - with
ID - (Autonumber)
LogItemDesc - Text(250)
DateStamp - Date(8)

Create a Function in a Module, I place mine in a Utilities Module.
Function InsertLog(lcDesc As String)
Dim ThisDB As DAO.Database
Dim lcSQL As String
Set ThisDB = CurrentDb
lcSQL = "INSERT INTO tbl_Log (LogItemDesc, DateStamp) "
lcSQL = lcSQL & "VALUES ('" & lcDesc & "',Now())"
ThisDB.Execute lcSQL, dbFailOnError
End Function

Last
When ever you want to log acitvity, simply call the InsertLog function.

For example...
Utilities.InsertLog ("Delete " & rsOtherAdjust("reccnt") & " Existing Entries From tbl_adjust_trans for Loan_No: " & loan_no & " and EmpCode:" & lcEmpCode & ".")

On forms, you could place it on the After Update, After Insert or On Dirty Events? Depends upon your needs and database/system design. Optionally, you could add another field called User ID to the tblLog and pass in the User ID that is either derived from the Network or from the Login screen.

htwh,

Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
for a somewhat more elaborate version, see faq181-291





MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top