Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Multiuser / Networking / March 2006

Tip: Looking for answers? Try searching our database.

Users

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jwa - 11 Mar 2006 11:35 GMT
Hi All,

How can I determine wich users (or machines) are logged onto a back-end
database?
(in case of maintenance ?)
And how can I kick them out (after a first friendly request)

regards, Joop
Mauricio Silva - 20 Mar 2006 21:19 GMT
Hi JWA, I use the following function that it is in a form with:
- A TextBox named TextUserName
- A TextBox named TextPassword
- A TextBox named TextPath for full database path
- A ListBox named ListUser set to show 3 columns

Note that your machine will appear once in the list because you're connected
to read the list.

Hope I helped.
Mauricio Silva

Public Function WhoIsIn() As Boolean
   Dim cn As ADODB.Connection
   Dim rs As ADODB.Recordset
   
   Dim PCName As String
   
   Dim strUserID As String
   Dim strUserName As String
   Dim strMachineName As String
   
   On Error GoTo UsrMsg_Err
   
   Set cn = New ADODB.Connection
   Set rs = New ADODB.Recordset
   
   'Setup the connection.
   cn.Provider = "Microsoft.Jet.OLEDB.4.0"
   cn.Properties("Jet OLEDB:System database") = "System.mdw"  ' Enter full
path
   
   ' Just in case there is any
   If Nz(TextUserName, "") = "" Then
'        cn.Properties("User ID") = Null
'        cn.Properties("Password") = Null
   Else
       cn.Properties("User ID") = TextUserName
       cn.Properties("Password") = TextPassword
   End If
   
   cn.Open "Data Source=" & TextPath
 
   'Open the connection
   Set rs = cn.OpenSchema(adSchemaProviderSpecific, ,
"{947bb102-5d43-11d1-bdbf-00c04fb92675}")
   
   ' ================================================
   ListUser.RowSource = "Machine;User ID;User Name"
   
   While Not rs.EOF
       strMachineName = Replace(Trim(Nz(rs.Fields(0), "")), Chr(0), "")
       strUserID = Replace(Trim(rs.Fields(1)), Chr(0), "")
       strUserName = Nz(DLookup("MachineUser", "Machine", "MachineID = """
& strMachineName & """"), "")
       
       ListUser.RowSource = ListUser.RowSource & ";" & _
                            strMachineName & ";" & _
                            strUserID & ";" & _
                            strUserName
       
       rs.MoveNext
   Wend
   
   WhoIsIn = True
   
Exit_UsrMsg:
   On Error Resume Next
   rs.Close
   cn.Close
   Set rs = Nothing
   Set cn = Nothing
   Exit Function
   
UsrMsg_Err:
   DoCmd.Beep
   MsgBox "Error: " & Err.Number & vbCrLf & Err.Description, vbExclamation
   WhoIsIn = False
   
   Resume Exit_UsrMsg
   
End Function

> Hi All,
>
[quoted text clipped - 4 lines]
>
> regards, Joop
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.