I have used code from MS 198755 to create a module that lists current
users of the database. Works fine as long as db isnot password
potected. How do I adapt code to enter password?
This is code:
Sub ShowUserRosterM ultipleUsers()
Dim cn As New ADODB.Connectio n
Dim cn2 As New ADODB.Connectio n
Dim rs As New ADODB.Recordset
Dim i, j As Long
cn.Provider = "Microsoft.Jet. OLEDB.4.0"
cn.Open "Data Source=c:\North wind.mdb"
cn2.Open "Provider=Micro soft.Jet.OLEDB. 4.0;" _
& "Data Source=c:\North wind.mdb"
' The user roster is exposed as a provider-specific schema rowset
' in the Jet 4 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
Set rs = cn.OpenSchema(a dSchemaProvider Specific, _
, "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
'Output the list of all users in the current database.
Debug.Print rs.Fields(0).Na me, "", rs.Fields(1).Na me, _
"", rs.Fields(2).Na me, rs.Fields(3).Na me
While Not rs.EOF
Debug.Print rs.Fields(0), rs.Fields(1), _
rs.Fields(2), rs.Fields(3)
rs.MoveNext
Wend
End Sub
Many thanks for any help
users of the database. Works fine as long as db isnot password
potected. How do I adapt code to enter password?
This is code:
Sub ShowUserRosterM ultipleUsers()
Dim cn As New ADODB.Connectio n
Dim cn2 As New ADODB.Connectio n
Dim rs As New ADODB.Recordset
Dim i, j As Long
cn.Provider = "Microsoft.Jet. OLEDB.4.0"
cn.Open "Data Source=c:\North wind.mdb"
cn2.Open "Provider=Micro soft.Jet.OLEDB. 4.0;" _
& "Data Source=c:\North wind.mdb"
' The user roster is exposed as a provider-specific schema rowset
' in the Jet 4 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
Set rs = cn.OpenSchema(a dSchemaProvider Specific, _
, "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
'Output the list of all users in the current database.
Debug.Print rs.Fields(0).Na me, "", rs.Fields(1).Na me, _
"", rs.Fields(2).Na me, rs.Fields(3).Na me
While Not rs.EOF
Debug.Print rs.Fields(0), rs.Fields(1), _
rs.Fields(2), rs.Fields(3)
rs.MoveNext
Wend
End Sub
Many thanks for any help
Comment