Solved

Data Source=Active Directory Provider

Posted on 2007-04-06
6
518 Views
Last Modified: 2013-12-24
What I want to do is this.
From a form in MS access, query LDAP to retrieve specific information, based on the a UserID.
I found this code floating around, and I am not sure if I am doing things right.
When I examine differant sets of code I see this:
conn.Open "Data Source=Active Directory Provider;Provider=ADsDSOObject"

Now my question is, what should I be putting between the quotes?
The code goes to it's error routine right after this liine:
Set rs = conn.Execute(sQuery)
which tells me either the sQuery variable is wrong or I am not getting a connection.

If you need to see more of or all the code I will be glad to post it. I am just not sure if I should post all the code here.

Any help would be great.

Thanks
Greg
0
Comment
Question by:GKnoll
  • 4
  • 2
6 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 18868456
What are you looking to pull?

Set conn=CreateObject("ADODB.Connection")
Set cmd=CreateObject("ADODB.Command")
conn.Provider="ADsDSOObject"
conn.Open "Active Directory Provider"
cmd.ActiveConnection=conn
cmd.CommandText="Select sAMAccountName From 'LDAP://dc=somewhere,dc=com' Where objectCategory='user' And sAMAccountName='" & strUser & "'"
Set rs=cmd.Execute
If Not rs.Eof Then
  'reference rs.Fields(0).Value
End If
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18868460
Hmm - for that to search though, you'll need:
Const SubTree_Scope=2

And add cmd properties of
cmd.Properties("SearchScope"=SubTree_Scope
after the activeconnection is established...
0
 

Author Comment

by:GKnoll
ID: 18868477
Set conn=CreateObject("ADODB.Connection")
Set cmd=CreateObject("ADODB.Command")
conn.Provider="ADsDSOObject"
conn.Open "Active Directory Provider"
cmd.ActiveConnection=conn
cmd.CommandText="Select sAMAccountName From 'LDAP://dc=somewhere,dc=com' Where objectCategory='user' And sAMAccountName='" & strUser & "'"
Set rs=cmd.Execute
If Not rs.Eof Then
  'reference rs.Fields(0).Value
End If

What I need to know is in the line ==>conn.Open<== am I supposed to have "Active Directory Provider" these words exactly, or am I supposed to put in the informaion to my active directoy provider.
Further, the active directory provider is what? the server it self? ie: mail.company.com?

I am sorry but this LDAP stuf makes me crazy.

Greg
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 67

Accepted Solution

by:
sirbounty earned 125 total points
ID: 18868485
Yes, just as I posted - just change your LDAP info (dc=???, dc=???) (company.com? - would be dc=company,dc=com)
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18868494
What was missing?
Just curious why the "B" grade?
0
 

Author Comment

by:GKnoll
ID: 18868509
I understand what I need for the LDAP Info. I gues I am just confused about what specificly follows

conn.open ??????????????

It just doesn't seem to make sense to have the string "Active Directory Provider". Is that how the provider is referenced with the ADsDSOObject ??? If so thats ok. Then my problem is either in the query string or the LDAP info I am using is not quite right.

Thank you for all your help.

I think maybe I just need to study this whole thing some more.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Get the ms access version 4 34
Replace special characters in Access VBA 8 33
How calculate median 5 38
Search field on a form 7 17
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now