GKnoll
asked on
Data Source=Active Directory Provider
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=ADsDSOOb ject"
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
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=ADsDSOOb
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
Hmm - for that to search though, you'll need:
Const SubTree_Scope=2
And add cmd properties of
cmd.Properties("SearchScop e"=SubTree _Scope
after the activeconnection is established...
Const SubTree_Scope=2
And add cmd properties of
cmd.Properties("SearchScop
after the activeconnection is established...
ASKER
Set conn=CreateObject("ADODB.C onnection" )
Set cmd=CreateObject("ADODB.Co mmand")
conn.Provider="ADsDSOObjec t"
conn.Open "Active Directory Provider"
cmd.ActiveConnection=conn
cmd.CommandText="Select sAMAccountName From 'LDAP://dc=somewhere,dc=co m' 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
Set cmd=CreateObject("ADODB.Co
conn.Provider="ADsDSOObjec
conn.Open "Active Directory Provider"
cmd.ActiveConnection=conn
cmd.CommandText="Select sAMAccountName From 'LDAP://dc=somewhere,dc=co
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What was missing?
Just curious why the "B" grade?
Just curious why the "B" grade?
ASKER
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.
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.
Set conn=CreateObject("ADODB.C
Set cmd=CreateObject("ADODB.Co
conn.Provider="ADsDSOObjec
conn.Open "Active Directory Provider"
cmd.ActiveConnection=conn
cmd.CommandText="Select sAMAccountName From 'LDAP://dc=somewhere,dc=co
Set rs=cmd.Execute
If Not rs.Eof Then
'reference rs.Fields(0).Value
End If