Thanks
IOW?
I was reading KB 198756, the next KB article after the one you referenced as
well as 285822 which refers to A2k2 & A2k3. KB 198756 includes connection
control. Both use ADO which I have not used much, preferring DAO which has
given me far more control over what I have needed to date. Both articles
refer to the CURRENT database/connection where I want another, user selected,
database/connection. I am reading up on ADO to get up to speed and to change
the articles to another database/connection
I have also been looking at the LDB itself and several articles which
describe it. As it is always in the same directory as the database and has
the same name it is easily located & has a simple structure. You can easily
examine it in Word.
Using ADO also allows you to check the status of connections as well as
checking for problem connections &, therefore, is probably worth pursuing
The following code is my first pass:
'=======================================
Public Sub ShowCurrentUsers(Optional sDatabase As String)
'Lists the Current Users in the public array gvUsers()
'For sDatabaseName. If not specified the current database is assumed
Dim Rs As ADODB.Recordset
Dim cn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Dim i, j As Long
If IsMissing(sDatabaseName) Then
Set cn = CurrentProject.Connection
Else
'This is the code I need
End If
' The user roster is exposed as a provider-specific schema rowset
' in the Jet 4.0 OLE DB provider. You have to use a GUID to
' reference the schema, as provider-specific schemas are not
' listed in ADO's type library for schema rowsets
'I assume the following reference applies to any connection
Set Rs = cn.OpenSchema(adSchemaProviderSpecific, ,
"{947bb102-5d43-11d1-bdbf-00c04fb92675}")
'Output the list of all users in the database to the global array
Rs.MoveFirst
i = 0
While Not Rs.EOF
ReDim Preserve gvUsers(i + 1, 3)
'Computer name
gvUsers(i, 0) = Trim(Left(Rs.Fields(0), InStr(Rs.Fields(0), Chr(0))
- 1))
'User name
gvUsers(i, 1) = Trim(Left(Rs.Fields(1), InStr(Rs.Fields(1), Chr(0))
- 1))
'Connection status
gvUsers(i, 2) = Trim(Str(Rs.Fields(2)))
'Connection State
gvUsers(i, 3) = Trim(Rs.Fields(3) & "")
i = i + 1
Rs.MoveNext
Wend
Set Rs = Nothing
End Sub
'=======================================
Thanks for your help
Terry