Results 1 to 6 of 6
  1. #1
    AlaskanDSM is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    Mar 2016
    Posts
    3

    Computer lab sign in form - Cannot select a different name from the list if clicked accidentally

    Hello all,



    I have been developing a relatively simply simply sign in sheet for tracking the usage of a computer lab and I have everything working except for one piece. When users need to click on their name to sign out, if you accidentally click the wrong name in from the list, you are not able to select a different name from the list. Example, in my image, if I am John and I accidentally click on Jane, I am not able to reselect John from the list. I am hoping that someone can help me identify a way to rectify the problem. Thank you!


  2. #2
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Do you have any events on the listbox? If so, post the code (please use code tags). As an aside, do you have any form validation that ensures the user cannot log out without checking a box or filling in the 'other' textbox?
    Last edited by Micron; 03-29-2016 at 05:07 PM. Reason: spelling
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    AlaskanDSM is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    Mar 2016
    Posts
    3
    I am still a novice user of Access so forgive me if I am not as immediate with procuring the information that you are requesting. Please do not hesitate to request additional information! Thank you for your help.

    This is what is have setup in my Macros:

    Command80 is a button I used to clear the fields and go to the newest record.
    List85 is where names will show up when they sign in.
    SignIn is my Sign in button
    Sign_Out is my sign out button

    Code:
    Option Compare Database
    
    Private Sub Command80_Click()
        DoCmd.GoToRecord , , acNewRec
    End Sub
    
    
    Private Sub Form_Load()
        DoCmd.Maximize
        DoCmd.GoToRecord , , acNewRec
    End Sub
    
    
    Private Sub List85_AfterUpdate()
    ' Find the record that matches the control.
        Dim rs As Object
    
    
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[ID] = " & Str(Nz(Me!
    [List85], 0))
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    End Sub
    
    
    Private Sub SignIn_Click()
        
    ' perform data validation
    If (IsNull(Me.FirstName)) Then
        MsgBox "You must enter your first name."
        Cancel = True
        Exit Sub
    ElseIf (IsNull(Me.LastName)) Then
        MsgBox "You must enter your last name."
        Cancel = True
        Exit Sub
    End If
    
    
    Dim bolOK As Boolean
    
    
        bolOK = Nz(Me.Reason1, False) Or _
                    Nz(Me.Reason2, False) Or _
                    Nz(Me.Reason3, False) Or _
                    Nz(Me.Reason4, False) Or _
                    Nz(Me.Reason5, False) Or _
                    Nz(Me.Reason6, False)
            If Not bolOK Then
                bolOK = (Trim(Me.ReasonOther & "") <> "")
            End If
            If Not bolOK Then
                Cancel = True
                MsgBox "You must select at least one checkbox from the 'Reason for vist' list " & _
                "or type your reason in the 'Other Reason' field."
                Exit Sub
            End If
    
    
        If bolOK Then
        bolOK = Nz(Me.Association1, False) Or _
            Nz(Me.Association2, False) Or _
            Nz(Me.Association3, False) Or _
            Nz(Me.Association4, False) Or _
            Nz(Me.Association5, False)
            If Not bolOK Then
                Cancel = True
                MsgBox "You must select at least one checkbox from the 'Associations' list."
            Exit Sub
            End If
        End If
    
    
        Me.TimeIn = Time
        
    On Error GoTo Err_SignIn_Click
    
    
        Dim stDocName As String
        Dim stLinkCriteria As String
    
    
        DoCmd.GoToRecord , , acNewRec
        
        'Refresh List
        List85.Requery
        
    Exit_SignIn_Click:
        Exit Sub
    
    
    Err_SignIn_Click:
        MsgBox Err.Description
        Resume Exit_SignIn_Click
    End Sub
    
    
    Private Sub Sign_Out_Click()
    
    
    ' perform data validation
    If (IsNull(Me.TimeIn)) Then
    
    
       MsgBox "You must sign in before you can sign out."
          
       Cancel = True
       Exit Sub
    
    
    End If
        
        Me.TimeOut = Time
        
        On Error GoTo Err_Sign_Out_Click
    
    
        Dim stDocName As String
        Dim stLinkCriteria As String
          
        DoCmd.GoToRecord , , acNewRec
        
        'Refresh List
        List85.Requery
        
    Exit_Sign_Out_Click:
        Exit Sub
    
    
    Err_Sign_Out_Click:
        MsgBox Err.Description
        Resume Exit_Sign_Out_Click
    End Sub

  4. #4
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    It would be pointless for me to try to digest everything you're doing because I'm suggesting you change it anyway. Simplest would be to move the code you have for the list, allow the user to select a name, then ask if they're sure they want to log out as Jane/John/Whoever (use a message box). If they say no, end the process. If yes, then run code against your list.

    Better would be to store the logged in identity using the Environ function or fosUserName() (my preference). Google those and choose one. Simplest for now would be for you to store that value on a hidden control on this form. When user selects a name, check the selection against this form control value and message if not right and stop the process like already mentioned. Better yet is to store the logged in user in a table, bring it into the listbox (you don't have to make it visible) and do the comparisons as before.

    If you're not in a hurry, research database normalization and Access object naming conventions. Six months from now, things like List85 don't help you debug issues. If you are, you really should research those later.
    Last edited by Micron; 03-29-2016 at 05:53 PM. Reason: grammar
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    AlaskanDSM is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    Mar 2016
    Posts
    3
    I do appreciate your honestly with this situation. For any future work, I will gladly take your suggestions into consideration and research the given terms you have provided.


    Sadly, I have already invested quite a bit of time into what I currently have and I don't have much time left to be able to further develop this database. The form is completely functional where we need it except for this one piece... which I cannot seem to understand nor figure out why it doesn't work. If I posted the file itself, would that possibly aid in identifying a solution to my current problem? I understand that my form is probably not the ideal solution to someone who has been working with Access for a while, but again, I am a quite new to Access and this is what I was able to cobble together in just a couple weeks. I really have minimal knowledge or experience with Access.

    One reason for having the names visible on the list and selectable is for the lab workers to be able to see who is in the lab at a glance to see if someone has not signed in or if someone forgot to sign out before leaving, as well as when they click on a name, it will show the reason that they are in the lab.

    Thank you again for your assistance and suggestions Micron.

    I have added a link to the file here. Please note that there are no current entries in the table.
    Last edited by AlaskanDSM; 03-29-2016 at 06:51 PM. Reason: Added URL to database file, misc info.

  6. #6
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Better to zip a db copy and post here so others can chime in if they wish. I took a look at what you have and played around. Stopped because I can't decide where to stop fixing stuff. It really needs a different approach. I won't put a copy here because I don't have your permission so I will pm you a link for this reason. You can review my code notes as well as my comments in the attached file.
    LabDbNotes.txt

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

Similar Threads

  1. Select File from Computer and Save to Shared Drive
    By sgrimmer in forum Import/Export Data
    Replies: 4
    Last Post: 11-02-2015, 03:43 PM
  2. Replies: 8
    Last Post: 06-16-2015, 02:05 AM
  3. Sign Out and Sign In Student Database
    By jamiers in forum Forms
    Replies: 6
    Last Post: 08-29-2012, 02:03 PM
  4. Replies: 35
    Last Post: 09-19-2011, 10:13 AM
  5. Replies: 1
    Last Post: 10-22-2010, 10:11 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