Solved Testing Accounts in AD Query

pooldead

Registered User.
Local time
Today, 02:18
Joined
Sep 4, 2019
Messages
136
I have a list of different AD accounts with certain permissions on our network. This list includes Users and Groups, however does not mention which is which. I have separate LDAP queries that I can run from Access to pull information based on whether the objectClass is User or Group. What I am wondering is: Is there a way to build a check in the code that basically says "If objectClass=User Then Run UserLdap Else Run GroupLdap"?

Or maybe take advantage of SELECT CASE?

Obviously the sample above is incredibly basic and not how I would actually set it up, but I wanted to describe the idea I had in my head.
 
Access SQL does not recognize SELECT CASE. If by "code" you mean VBA then yes, can have conditional branching.
 
Access SQL does not recognize SELECT CASE. If by "code" you mean VBA then yes, can have conditional branching.
My apologies. Yes, I did mean VBA (it's been a long day). I've used conditional branching before, but never with LDAP queries. Do you have an example of how I could set one up?
 
Hi. Not sure if this will help but thought I'd point you to it anyway. Cheers!

That's close to what I was looking for. However, I won't know ahead of time which test the account fits into. I will have to run the account through, let's say, the objectClass=User test first. If the account pulls results, enter user information. If not, run the account through the objectClass=Group test, then enter group information. If the account isn't found in either, spit out a msgbox.
 
there is a thread somewhat similar.

 
I figured this one out. I didn't realize I could modify my LDAP query to look only for the samAccountName, and not need to specify the objectClass at this stage. Thanks to everyone for your advice!
 
I figured this one out. I didn't realize I could modify my LDAP query to look only for the samAccountName, and not need to specify the objectClass at this stage. Thanks to everyone for your advice!
Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom