Solved

Data Source=Active Directory Provider

Posted on 2007-04-06
6
575 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

742 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