Results 1 to 5 of 5
  1. #1
    roce is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    3

    SignOut specific user from table


    So I have this hand-me down Access document which is a SignIn SignOut tracker. Unfortunately at some part in this code when you go to sign out it will sign out anyone instead of specifically signing out the requested person. Where is the issue? I will do whatever is required to get some help with this. Thanks a lot.

    Code:
    Option Compare Database
    Private Sub Name_Last_AfterUpdate()
    End Sub
    Private Sub Sign_In_Exit(Cancel As Integer)
    Dim MyNow
        MyNow = Now
        Sign_In = MyNow
    End Sub
    Private Sub cmdCloseForm_Click()
        DoCmd.Close
    End Sub
    Private Sub Combo59_GotFocus()
        Me.Combo59.SetFocus
    End Sub
    Private Sub Combo59_LostFocus()
        
    End Sub
    Private Sub Form_AfterInsert()
    End Sub
    Private Sub Name_Last_List_Box_AfterUpdate()
    ' Find the record that matches the control.
        Dim rs As Object
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[Name_Last] = '" & Me![Name_Last_List_Box] & "'"
        If Not rs.EOF Then
            Me.Bookmark = rs.Bookmark
        Else
            Me.Combo59 = ""
        End If
    End Sub
    Private Sub Form_Current()
        Me.Combo59.SetFocus
    End Sub
    Private Sub Sign_Out_Button_Click()
    On Error GoTo Err_Sign_Out_Button_Click
        If Me.Combo59 Is Null Or Me.Combo59 = "" Then
            DoCmd.Close
        Else
            Set rs = Me.Recordset.Clone
            rs.FindFirst "[Name_Last] = '" & Me![Combo59] & "'"
            If Not rs.EOF Then Me.Bookmark = rs.Bookmark
            If Me.Elec_Device = "YES" Then
                DoCmd.OpenForm "ElecDeviceReminder", acNormal
            Else
                DoCmd.Close
            End If
        End If
    Exit_Sign_Out_Button_Click:
        Exit Sub
    Err_Sign_Out_Button_Click:
        If Me.Combo59 = "" Then
            DoCmd.Close
        Else
            Me.Combo59.LimitToList = False
            Me.Combo59 = ""
            If Me.Combo59 = "" Then
                DoCmd.Close
            Else
                MsgBox Err.Description
                Resume Exit_Sign_Out_Button_Click
            End If
        End If
    End Sub
    Private Sub Combo32_AfterUpdate()
        ' Find the record that matches the control.
        Dim rs As Object
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[Name_Last] = '" & Me![Combo32] & "'"
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    End Sub
    Private Sub Combo34_AfterUpdate()
        ' Find the record that matches the control.
        Dim rs As Object
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[Name_Last] = '" & Me![Combo34] & "'"
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    End Sub
    Private Sub Combo40_AfterUpdate()
        ' Find the record that matches the control.
        Dim rs As Object
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[Name_Last] = '" & Me![Combo40] & "'"
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    End Sub
    Private Sub List42_AfterUpdate()
        ' Find the record that matches the control.
        Dim rs As Object
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[Name_Last] = '" & Me!
    [List42] & "'"
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    End Sub
    Private Sub List44_AfterUpdate()
        ' Find the record that matches the control.
        Dim rs As Object
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[Name_Last] = '" & Me!
    [List44] & "'"
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    End Sub
    Private Sub List49_AfterUpdate()
        ' Find the record that matches the control.
        Dim rs As Object
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[Name_Last] = '" & Me!
    [List49] & "'"
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    End Sub
    Private Sub Sign_Out_Exit_Button_Click()
    On Error GoTo Err_Sign_Out_Exit_Button_Click
    
        DoCmd.Close
    Exit_Sign_Out_Exit_Button_Click:
        Exit Sub
    Err_Sign_Out_Exit_Button_Click:
        MsgBox Err.Description
        Resume Exit_Sign_Out_Exit_Button_Click
        
    End Sub
    Private Sub Text52_BeforeUpdate(Cancel As Integer)
    End Sub
    Private Sub Combo59_AfterUpdate()
        ' Find the record that matches the control.
        Dim rs As Object
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[Name_Last] = '" & Me![Combo59] & "'"
        If Me.Combo59 = "" Then
            Else
            If Not rs.EOF Then
                Me.Bookmark = rs.Bookmark
                Me.Sign_Out = Me.SignOutDate
                Me.Sign_Out_Button.SetFocus
            Else
                Me.Combo59 = ""
            End If
        End If
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Step debug. Follow code as it executes. Review link at bottom of my post for debugging guidelines.
    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.

  3. #3
    roce is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    3
    Thanks i'll give it a try and see where it leads me.

  4. #4
    roce is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    3
    Ok so I wasn't really able to run debug. I followed the step-in command instructions from your link but when I hit F8 it doesn't really debug my line code under the form. Anyways, I kind of figured out through attrition that the functionality appears to be there but it might be missing a function that you may be able to help with.

    So as I stated my goal is to sign a user out when entering his/her name. The code does that, however, say if you have two users that log in this order Hickey (sign-in) Hilyer (sign-in). Hickey goes to sign out and in the Last name box enters Cheeseburger instead of "Hickey"... this will sign out Hilyer or whoever the last person to log in is.

    The functionality I should have requested is that there be something that prevents the user from signing anyone out other than themselves.

    Thank you for your time on this.

    -Ross

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I have a Users table. When user opens db, code grabs their username from network login as well as the computer name, finds user in table and saves computer name in their record. A main menu form is opened and never closes until db is closed. A textbox on form is populated with user ID. When user closes db, code in this form Close event finds the user and deletes computer name from their record. That is my 'login/logout' procedure. User doesn't even know this is happening.

    Review https://www.accessforums.net/access/...gin-23585.html
    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: 4
    Last Post: 12-22-2014, 11:07 AM
  2. Replies: 6
    Last Post: 04-26-2014, 08:54 PM
  3. Form reminders for specific user only
    By Koloss in forum Forms
    Replies: 6
    Last Post: 02-27-2014, 12:09 PM
  4. User-level access to specific records
    By gbonnaville in forum Security
    Replies: 7
    Last Post: 03-29-2012, 11:14 AM
  5. Access specific form by user
    By GilbertPet in forum Programming
    Replies: 1
    Last Post: 01-12-2012, 01:09 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