Solved

Data Source=Active Directory Provider

Posted on 2007-04-06
6
544 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

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Read about achieving the basic levels of HRIS security in the workplace.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

803 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