Solved

Data Source=Active Directory Provider

Posted on 2007-04-06
6
529 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

867 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

22 Experts available now in Live!

Get 1:1 Help Now