Results 1 to 2 of 2

Thread: Access 2003 - Authenticate w/Active Directory

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Washington DC
    Posts
    330

    Access 2003 - Authenticate w/Active Directory

    How do you authenticate a login against the LDAP/ACtive directory via VBA, in Access 2003?

    I know how in .net but I can not seem to organize it in a manner acceptable by access.
    Swoozie
    Somedays you just should not get out of bed.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Washington DC
    Posts
    330

    Re: Access 2003 - Authenticate w/Active Directory

    Here is what I have come up with so far and it isnt working. I noted the location if fails. any ideas?

    Code:
    Public Function AccessLDAP()
        Dim con As ADODB.Connection
        Dim cmd As ADODB.Command
        Dim rs As ADODB.Recordset
        Dim txtMsg As String
        Dim ADsPath As String
    
      ADsPath = "LDAP://CN= XXXXX,CN=users,DC=XXXXXX,DC=XXX"
      'set the connection
        Set con = New ADODB.Connection
        With con
            .Provider = "ADsDSOObject"
            '.Properties("ADSI Flag") = 0
    
            .Open "ADSI", , 0
        End With
        
      'set the command object
        Set cmd = New ADODB.Command
        With cmd
            .ActiveConnection = con
            .CommandText = "<" & ADsPath & ">;(&(userreferencedn= xxxxxx)(auid=xxxxx));ADsPath;Subtree"
            .Properties("Page Size") = 1000
            .Properties("Timeout") = 30
            .Properties("Cache Results") = True
        End With
        
        Set rs = cmd.Execute                    'THIS IS WHERE RCVD ERROR TABLE DOES NOT EXISIT
        If Not (rs.BOF And rs.EOF) Then         
           rs.MoveLast                         
           rs.MoveFirst           
          Debug.Print "Record Count: " & rs.RecordCount
                
           While Not rs.EOF
                Debug.Print rs.Fields(0)
                rs.MoveNext
           Wend
            
    
          End If
    
      'close and clean up
        rs.Close
        Set rs = Nothing
        cmd.Cancel
        Set cmd = Nothing
        con.Close
        Set con = Nothing
    End Function
    Swoozie
    Somedays you just should not get out of bed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width