Results 1 to 2 of 2
  1. #1
    RoyLittle0 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2012
    Posts
    25

    Need help with a simple Login Logout tracking system

    Hi,



    I want to be able to track each person who logs in to the database, I thought it could be done by using the Forms On Load event to trigger this then I need to be able to read who has logged on and the time and date.

    I am using Environ("username") to automatically log people on.

    I have created a Form AuditLogin with fields below, I want to automatically save the data of everyone who logs on to the database

    ID (Auto Number)
    LoggedIn (Date /Time) Date and time the user logged in
    LoggedOut (Date/Time) Date and time the user logged out
    UserName (Text) Login name (username)

    how can I log the information and save it to the Table

    Thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Use form Load or Open or Current or Close event to save record to table. If the form is bound to that table and opens only to new record, use code to populate the fields. If the form is unbound then use code to execute an SQL INSERT and/or UPDATE action. I think the latter method will be more difficult if you want the log in and log out dates in the same record because this requires the ID to specify the record to update.

    CurrentDb.Execute "INSERT INTO tablename(UserName, LoggedIn) VALUES('" & Environ("USERNAME") & "', #" & Now & "#)"

    CurrentDb.Execute "UPDATE SET LoggedOut=#" & Now & "# WHERE ID=" & DMax("ID","tablename","UserName='" & Environ("USERNAME") & "'")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 06-28-2012, 01:46 AM
  2. simple tracking
    By sk88 in forum Access
    Replies: 5
    Last Post: 12-16-2011, 01:14 PM
  3. Login System
    By anwaar in forum Programming
    Replies: 2
    Last Post: 09-02-2011, 01:31 PM
  4. login tracking
    By itsmemike in forum Access
    Replies: 8
    Last Post: 09-18-2010, 08:05 AM
  5. Cafeteria tracking system design
    By tsr_83 in forum Programming
    Replies: 2
    Last Post: 07-28-2010, 09:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums