Results 1 to 2 of 2
  1. #1
    mahdinoori is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2017
    Posts
    1

    track login and logout times

    Hi


    I have a Problem in VBA code in Ms Access 2013
    I want to Store Time of login users.
    I work with New Ribbon I customized myself and I used lngSelectedUser code in checking Correctness of username and password like this:
    Private Sub Command3_Click()
    lngSelectedUser = Nz(DLookup("[User-id]", "[Users]", "[Password] = '" & Me!text2 & "' AND [UserName] = '" & Me!Text1 & "'"), 0)
    If lngSelectedUser = 0 Then
    MsgBox "Wrong Name / Password", vbCritical, "Login"
    lngSelectedUser = 0
    End If
    UpdateRibbon

    My question is How to record the daily login and logout time of a particular user?
    I have done search in different sites and forums about this, but the result is null. In fact I need a sample database which I can get pattern in my own project.
    Please help me and if it is possible send me your Access sample database.
    tnx.


  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Create a table to hold the records.

    Use SQL INSERT actions.

    CurrentDb.Execute "INSERT INTO UserLog(InDateTime, UserID, Status) VALUES(Now(), " & Me.[User-id] & "'In')"

    CurrentDb.Execute "INSERT INTO UserLog(InDateTime, UserID, Status) VALUES(Now(), " & Me.[User-id] & "'Out')"

    The real trick is figuring out what event(s) to put code into.
    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. Tracking Login and Logout
    By billmark in forum Programming
    Replies: 3
    Last Post: 09-19-2016, 07:52 AM
  2. code for logout
    By rameshjctr in forum Programming
    Replies: 4
    Last Post: 04-20-2016, 10:24 PM
  3. Replies: 2
    Last Post: 02-25-2015, 05:02 PM
  4. Limit times users can login
    By rcoreejes in forum Access
    Replies: 2
    Last Post: 06-28-2013, 06:13 AM
  5. Replies: 1
    Last Post: 02-17-2013, 06:54 AM

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