M
microb0x
I have a function in place to determine the current user roster for an
access db. I will paste that sub below. The results of this function
provide me with the Computer_Name, Login_Name(access's not windows),
Connected, and Suspect_State.
My question is, is there a way for me to gather all the windows logins
for every user currently in the db? The computer name is nice, but not
much use to me as I dont have a quick reliable way to attach a person
to a computer name. Additionaly some of my access applications are
accessed via a citrix environment so in those cases the computer name
is just a citrix server, and I have no way of attaching that to a user.
Basically I need the windows ID for all users that are in my database
as a given time.
Here is my current sub for determining the computer name(courtesy of
another user in this group):
Sub ShowUserRosterMultipleUsers()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i, j As Long
'Set cn = CurrentDb.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & vDbPath
' 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
Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
, "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
'Output the list of all users in the current database.
DoCmd.OpenForm "frmDbUsers_Data"
With Form_frmDBUsers_Data.lstUsers
.AddItem (rs.Fields(0).Name & ";" & rs.Fields(1).Name & _
";" & rs.Fields(2).Name & ";" & rs.Fields(3).Name)
End With
While Not rs.EOF
With Form_frmDBUsers_Data.lstUsers
.AddItem (Left(Trim(rs.Fields(0)), Len(Trim(rs.Fields(0)))
- 1) & _
";" & Left(Trim(rs.Fields(1)),
Len(Trim(rs.Fields(1))) - 1) & _
";" & Trim(rs.Fields(2)) & ";" &
Trim(rs.Fields(3)))
End With
rs.MoveNext
Wend
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
End Sub
access db. I will paste that sub below. The results of this function
provide me with the Computer_Name, Login_Name(access's not windows),
Connected, and Suspect_State.
My question is, is there a way for me to gather all the windows logins
for every user currently in the db? The computer name is nice, but not
much use to me as I dont have a quick reliable way to attach a person
to a computer name. Additionaly some of my access applications are
accessed via a citrix environment so in those cases the computer name
is just a citrix server, and I have no way of attaching that to a user.
Basically I need the windows ID for all users that are in my database
as a given time.
Here is my current sub for determining the computer name(courtesy of
another user in this group):
Sub ShowUserRosterMultipleUsers()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i, j As Long
'Set cn = CurrentDb.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & vDbPath
' 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
Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
, "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
'Output the list of all users in the current database.
DoCmd.OpenForm "frmDbUsers_Data"
With Form_frmDBUsers_Data.lstUsers
.AddItem (rs.Fields(0).Name & ";" & rs.Fields(1).Name & _
";" & rs.Fields(2).Name & ";" & rs.Fields(3).Name)
End With
While Not rs.EOF
With Form_frmDBUsers_Data.lstUsers
.AddItem (Left(Trim(rs.Fields(0)), Len(Trim(rs.Fields(0)))
- 1) & _
";" & Left(Trim(rs.Fields(1)),
Len(Trim(rs.Fields(1))) - 1) & _
";" & Trim(rs.Fields(2)) & ";" &
Trim(rs.Fields(3)))
End With
rs.MoveNext
Wend
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
End Sub