How to Generate a User List

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wesley Hader
    New Member
    • Nov 2011
    • 30

    #16
    I have figured that part out. Now I need to know why it shows my computers connection twice and all others only once. This happens from each computer you bring up the user list form.

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #17
      @Wesley:
      Where, exactly, are you executing this Code from?

      Comment

      • Wesley Hader
        New Member
        • Nov 2011
        • 30

        #18
        I have a form called Frm_Con_Users. The above code is executed in the Form_Load event and the Form_Timer event. The function which I call List_Users contains the above code and is also in the forms code container (not sure if I referenced that correctly).

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          #19
          @Wesley:
          Are you executing the Code from the Front or Back End DB?

          Comment

          • Wesley Hader
            New Member
            • Nov 2011
            • 30

            #20
            From the front end. I want an "Administra tor" to see who is connected, while using the Front End Database. I had to do some tweaking to get this code to recognize my back end db connection.
            Last edited by Wesley Hader; Nov 3 '11, 03:58 PM. Reason: reworded

            Comment

            • ADezii
              Recognized Expert Expert
              • Apr 2006
              • 8834

              #21
              @Wesley:
              I could not duplicate your Error. Download the Attachment which I know works, then compare it to your configuration.
              Attached Files

              Comment

              • Wesley Hader
                New Member
                • Nov 2011
                • 30

                #22
                Thank you for the code and your time! The only difference between your form and mine are the connection properties. I am running my form from the Front End DB and connecting to the Back End DB using:
                Code:
                 cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
                              "Data Source="
                I have determined the problem is because I have multiple forms open that open recordsets in the Back End DB.

                Again, Thank you for your time. I will live with the current results.

                Comment

                • ADezii
                  Recognized Expert Expert
                  • Apr 2006
                  • 8834

                  #23
                  @Wesley:
                  You are quite welcome. You could actually write Code, parsing strUser and eliminating the Duplicates, since it is nothing more than a Semi-Colon Delimited String. Actually, assuming the Recordset is mirroring this Duplication, we should only process the Odd Number Rows and build strUser accordingly. I'm assuming the Even Rows would represent the Duplicates, but only you can test this for sure. Modify the GenerateUserLis t() Function slightly (Lines 12 and 14).
                  Code:
                  '*************************** Code Intentionally Omitted ***************************
                  With rst    'fills Recordset (rst) with User List data
                    Do Until .EOF
                      intUser = intUser + 1
                        For Each fld In .Fields
                          varValue = fld.Value
                            'Some of the return values are Null-Terminated Strings, if
                            'so strip them off
                            If InStr(varValue, vbNullChar) > 0 Then
                              varValue = Left(varValue, InStr(varValue, vbNullChar) - 1)
                            End If
                            If intUser Mod 2 <> 0 Then     'Process ODD Rows only
                              strUser = strUser & ";" & varValue
                            End If
                        Next
                          .MoveNext
                    Loop
                  End With
                  '*************************** Code Intentionally Omitted ***************************
                  P.S. - This Logic is useless if the Duplication does not exist!
                  Last edited by ADezii; Nov 4 '11, 01:14 AM. Reason: Possible solution

                  Comment

                  • Wesley Hader
                    New Member
                    • Nov 2011
                    • 30

                    #24
                    You got it! That omits the duplicate entry! Thanks again!!

                    Comment

                    • ADezii
                      Recognized Expert Expert
                      • Apr 2006
                      • 8834

                      #25
                      You are quite welcome, but remember that the Code is only applicable in your unique circumstance.

                      Comment

                      • tgrace
                        New Member
                        • Nov 2011
                        • 3

                        #26
                        This is GREAT... Really appreciate sharing all this info. The code works great for me (am using the updated code with GetUserName and ID)except when I test it with another User and I open the User List Form I will see 2 users on but with an ID showing myself twice. When I have the other user load the User List Form he sees himself twice. Very Odd.... We are opening the form in the back end.
                        Thanks for any assistance..... ....

                        Comment

                        • ADezii
                          Recognized Expert Expert
                          • Apr 2006
                          • 8834

                          #27
                          You are quite welcome, tgrace.

                          Comment

                          • tgrace
                            New Member
                            • Nov 2011
                            • 3

                            #28
                            Adezii..... Perhaps u did not read my entire content..... When I run the form it will show the total number of users in the back end but the ID (windows username) will all be mine on every line entry... Any thoughts? Thanks.....

                            Comment

                            • ADezii
                              Recognized Expert Expert
                              • Apr 2006
                              • 8834

                              #29
                              Any thoughts?
                              Unfortunately, I do not at the moment, and I have no means of simulating your conditions right now. I'll put my Thinking Cap back on and see what I can come up with.

                              Comment

                              • tgrace
                                New Member
                                • Nov 2011
                                • 3

                                #30
                                Thanks.... No problem... This is not time sensitive but am wondering if it has to do with the Citrix network that we are on. THanks again for responding so quickly.... Tim

                                Comment

                                Working...