View Single Post
  #3 (permalink)  
Old November 27th, 2006, 09:12 AM
mmcdonal mmcdonal is offline
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi,

   Create a function in a module. Put this code in:

Public Function sU()
sU = (Environ$("Username"))
End Function

   This will pull the username of the person opening the app as they are logged into their workstation.

   On your main form On Load event, put code that takes the current date/time (Now()) and the username from the module Function (sU()) and pass those to a table that has fields named: Username, Login, Logout.

   On your main form On Close event, put code that takes the sU(), then looks up in the table you made for record(s) where Username = sU, and Logout = "". Then push the current date/time to the logout field.

   This will keep a record of the login and logout times by user. You may want to set the table to hidden.

   Let me know if you want to add the following fields to your other tables to track this info:

DateCreated - per record
WhoCreated
DateModified
WhoModified

   These will only keep the name and date/time of the person who created a record, and the last name and date/time of the person who modified the record.

HTH



mmcdonal
Reply With Quote