473,883 Members | 1,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populate ComboBox from AD Query

I'm trying to populate a ComboBox on Form.load with a list of the OU's pulled
from AD. Here is the code that does not work:

Dim rootdir As New System.Director yServices.Direc toryEntry _
("LDAP://dc=corp,dc=abc, dc=com")
Dim rootsearch As New
System.Director yServices.Direc torySearcher(ro otdir)
Dim result As System.Director yServices.Searc hResult
rootsearch.Sear chScope = DirectoryServic es.SearchScope. Subtree
rootsearch.Filt er = ("(objectCla ss = organizational Unit)")
For Each result In rootsearch.Find All()
ComboBox2.Items .Add(result.Get DirectoryEntry)
Next

Any help would be greatly appreciated.... .

Thanks

Nov 21 '05 #1
1 2217
Did you try with objectClass=org anizationalUnit (no space between
organizational and Unit)?

"Primera" <Pr*****@discus sions.microsoft .com> wrote in message
news:8D******** *************** ***********@mic rosoft.com...
I'm trying to populate a ComboBox on Form.load with a list of the OU's
pulled
from AD. Here is the code that does not work:

Dim rootdir As New System.Director yServices.Direc toryEntry _
("LDAP://dc=corp,dc=abc, dc=com")
Dim rootsearch As New
System.Director yServices.Direc torySearcher(ro otdir)
Dim result As System.Director yServices.Searc hResult
rootsearch.Sear chScope = DirectoryServic es.SearchScope. Subtree
rootsearch.Filt er = ("(objectCla ss = organizational Unit)")
For Each result In rootsearch.Find All()
ComboBox2.Items .Add(result.Get DirectoryEntry)
Next

Any help would be greatly appreciated.... .

Thanks
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
285
by: raj | last post by:
I have a combo box that I want to populate from a SELECT query How to do this?
1
1549
by: John | last post by:
I have two fields on a form. Once called School, the second called SchoolZip I want the users to be able to go to the ComboBox field called School, select the school they want, and have it auto populate the SchoolZip field too. Combobox name = School Row Source Type = Table / Query Row Source = SELECT tSchools.School, tSchools.ZipCode FROM tSchools; Bound Column = 1
4
12870
by: godber | last post by:
I need to populate text boxes for instance with employee information using their unique employee works number selected from a combo box. Can anyone help, I am told thru visual basic this can be achieved.
11
12321
by: DSR | last post by:
Help Please... I would like to populate a combo box on a form with a query that compares data from two tables. Any record that is unique in table1 should continue to populate my combobox. The instant the record appears also in table2 it should no longer be listed in my combo box. This is not a key field in either of the tables. Basically what I am trying to do is prevent the user from entering duplicate values even though it is not a key...
16
10543
by: agrawal.solutions | last post by:
Hello Friends I am asking a very silly question but i dont find any solution fo this.. I am selectiong a recordset and want to populate a combobox where id would be inviseble and the content would. I am getting the recordset and the no of record but then i am unble to populate the combobox. I have already tried all the function starting form for each x in .... and while...wend and do....loop
5
5927
by: Rich | last post by:
Hello, I have a search application to search data in tables in a database (3 sql server tables). I populate 2 comboboxes with with data from each table. One combobox will contain unique CompanyID's. The second combobox will contain unique memberID's. Each of the tables that I have to search contain a CompanyID and a memberID field, and these fields are not unique in the respective tables. Like CompanyID, MemberID
1
6009
by: freekedoutfish | last post by:
Hi. New member here Im sat at work, pounding my head off the desk because this tiny bit of simple code refuses to work. The sub is intended to pull data from the "companyname" column in the "cmSelectAllCompanyNames" table, and put all the company names it finds into the "cbFilterCompanyName" combo box. Now the confusing aspect is this: It works!!!
3
11280
by: David | last post by:
I am trying to use Dlookup to populate a text box on a form, but haven't had any good luck so far. I've looked here at the posts and have used the Access help for examples. Northwind is way over my head. I think that I'm coming up short in the Criteria part of the function. I have a combo box that looks to the 'Student' table, 'Student_ID' field to list the students, and then places the selected value in the 'Student_ID' text box on...
2
2037
by: mpmason14 | last post by:
i know there is a way to populate one combobox based on another, but i've never done it myself and am looking for some help. i have a table that has SwitchNo and NumberofPorts as two columns. i want to create a union query to display the correct numberofports for the selected switch in switchno. ex) SwitchNo - 1 Numberofports - 24 switchno - 2
1
2318
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
This actually stemmed from anther post I created. But, I have two combo boxes. ComboBox1 is populated by a list of Systems (DataSet from Oracle Query). Now, I want to take Combobox2, and when the data is changed on Combox1, I want to populate data depending on the selection in Combox1. So, ComboBox1 lists "OracleDB123". I want ComboBox2 to list all accounts on that system. That information is stored in say the Accounts
0
9942
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11142
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10745
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9575
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7972
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5798
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5992
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.