C
Chuck
How can I set the ControlSource property of a list box to be a recordset? I
have a recordset that is essentially a LDAP query on an Active Directory
domain and I'd like to fill a list box control with that recorset. Here is
what I have so far. I can navigate within the recordset (with movenext,
etc) to get individual records but I'm having a hard time displaying the
entire recordset in a list box or even a form. Here's what I have so far:
Dim objConnection, objCommand
Dim strQuery
' Use ADO to search the domain for all users.
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOOBject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
strQuery =
"<LDAP://mydomaincontroller/OU=Users,OU=ou1,OU=ou2,DC=myorg,DC=com>;(&(objectCategory=person)(objectClass=user));displayName;subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
Me.MyListBox.ControlSource = ????
Thanks
have a recordset that is essentially a LDAP query on an Active Directory
domain and I'd like to fill a list box control with that recorset. Here is
what I have so far. I can navigate within the recordset (with movenext,
etc) to get individual records but I'm having a hard time displaying the
entire recordset in a list box or even a form. Here's what I have so far:
Dim objConnection, objCommand
Dim strQuery
' Use ADO to search the domain for all users.
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOOBject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
strQuery =
"<LDAP://mydomaincontroller/OU=Users,OU=ou1,OU=ou2,DC=myorg,DC=com>;(&(objectCategory=person)(objectClass=user));displayName;subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
Me.MyListBox.ControlSource = ????
Thanks