I'm using the following code I've found to try and populate a combo box with a list of users from Active directory.
I get a runtime error "Table Does Not Exist" and fails at the following line:
Any advice most welcome
I get a runtime error "Table Does Not Exist" and fails at the following line:
Code:
Set objRecordset = objCommand.Execute
Any advice most welcome

Code:
Private Sub Form_Current()
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Open "Provider=ADsDSOObject;"
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<LDAP://dc=ad,dc=integrasoft,dc=local>;(objectcategory=user);sn,givenname;subtree"
Set objRecordset = objCommand.Execute
Me.ComboBox1.RowSourceType = "Value List"
While Not objRecordset.EOF
Debug.Print objRecordset.Fields("givenname") & "," & objRecordset.Fields("sn")
Me.ComboBox1.AddItem (objRecordset.Fields("givenname") & "," & objRecordset.Fields("sn"))
objRecordset.MoveNext
Wend
objConnection.Close
End Sub