Active directory data into Access Table.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • usha2
    New Member
    • Mar 2012
    • 23

    Active directory data into Access Table.

    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:
    Code:
    objCommand.CommandText = "SELECT sAMAccountName " & _
                                "FROM 'LDAP://My AD Path"
                                
                          'Debug.Print objCommand.CommandText
            Set rsADSAMAccountName = objCommand.Execute
          'Debug.Print rsADSAMAccountName.GetString
          
         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.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32661

    #2
    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!Attr ibName syntax.

    Comment

    Working...