Make a new table in Access using fields from LDAP? Or read it fast

C

Crossh

Is it possible to just run a program, as needed, to create a local table in
Access from the Active Directory? It would only contain the information that
I need for use in my form? I am currently doing the following to read the
info, but it takes at least 30 seconds for each read. If not, any other ideas?

Set cnn = CreateObject("ADODB.Connection")
cnn.ConnectionString = "Provider=ADsDSOObject;Password=" & strUserPW &
";User ID=" & strUserId & ";Encrypt Password=True;Mode=Read;Bind Flags=0;ADSI
Flag=-2147483648"
cnn.Open
strSql = "SELECT DisplayName, Name, TelephoneNumber, Mail, Co, Department,
GivenName, SN FROM " & strLDAP WHERE samAccountName='*" & strUser & "' AND
objectCategory='person' AND objectClass='user'"
Set rst = cnn.Execute(strSql)
If Not rst.EOF Then
LdapLookup = True
Me.txtEmail = rst!mail
Me.txtPhone = rst!TelephoneNumber
Me.txtFirstName = rst!GivenName
Me.txtLastName = rst!SN
Me.txtLocation = rst!Co
Me.txtTeam = rst!Department
End If
cnn.Close
 
T

Tony Toews [MVP]

Crossh said:
Is it possible to just run a program, as needed, to create a local table in
Access from the Active Directory? It would only contain the information that
I need for use in my form? I am currently doing the following to read the
info, but it takes at least 30 seconds for each read. If not, any other ideas?

Absolutely. Although I wouldn't have thought it would take 30
seconds. Hmm, the culprit might be the * in samAccountName='*" &
strUser

See the TempTables.MDB page at my website which illustrates how to use
a temporary MDB in your app.
http://www.granite.ab.ca/access/temptables.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
C

Crossh

Holy cow, you were right! It was the * all the time. It was in the original
code that I started with, so I just assumed I needed it. Thanks for your help
:)
 
T

Tony Toews [MVP]

Crossh said:
Holy cow, you were right! It was the * all the time. It was in the original
code that I started with, so I just assumed I needed it. Thanks for your help
:)

Glad I could help.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top