By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,761 Members | 1,879 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,761 IT Pros & Developers. It's quick & easy.

Active directory data into Access Table.

P: 23
Hellow Sir,
I am working with Active Directory.
I have some data in my access database.
i need to compare these data with Active directory's sAMAccountname.
I used the SQL statement to pull AD information into a recordset.
But unable to compare with access table.
If the recordset from AD is in a temptable then it may be possible to compare with my existing Table.
So am i going in the right direction?
If yes,How can i create table with the recordset(which i pull from Active directory).
Please provide me some (VBA,access 2003) code.
My SQL code is:
Expand|Select|Wrap|Line Numbers
  1. objCommand.CommandText = "SELECT sAMAccountName " & _
  2.                             "FROM 'LDAP://My AD Path"
  4.                       'Debug.Print objCommand.CommandText
  5.         Set rsADSAMAccountName = objCommand.Execute
  6.       'Debug.Print rsADSAMAccountName.GetString
  8.      strSQL = "CREATE TABLE tempTbl(sAMAccountName varchar(255) NULL)"
In strSQL i am tring to create a tempTable but how can i INSERT my pulled recordset into this Table.
Thank You SoMuch Sir In advance.
Apr 5 '12 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 31,489
ADODB has the ability to open a recordset containing AD items. I don't tend to use ADODB very much myself, but there is certainly stuff out there to help with this.

Otherwise, VBA can deal with IADs items from your AD in a similar way to other such objects. For Each works with containers and multi-item properties and once .GetInfo has been run the attributes are all available via the IADsObject!AttribName syntax.
Apr 5 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.