CharlieT302
Instructor
Hi Folks
I am trying to query Active Directory by attaching code to a command button. When I run the code, which I have pieced together from various web links, I receive the message:
Error 424 Object Required. The line that "appears" to be the problem is as follows:
Wscript.Echo objRecordset.Fields("Name").Value
Does anyone see the error in the code below?
Private Sub Command0_Click()
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Open "Provider=ADsDSOObject;"
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<LDAP://dc=ad,dc=posdom,dc=org>;;name;subtree"
Set objRecordset = objCommand.Execute
While Not objRecordset.EOF
Wscript.Echo objRecordset.Fields("Name").Value
objRecordset.MoveNext
Wend
I am trying to query Active Directory by attaching code to a command button. When I run the code, which I have pieced together from various web links, I receive the message:
Error 424 Object Required. The line that "appears" to be the problem is as follows:
Wscript.Echo objRecordset.Fields("Name").Value
Does anyone see the error in the code below?
Private Sub Command0_Click()
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Open "Provider=ADsDSOObject;"
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<LDAP://dc=ad,dc=posdom,dc=org>;;name;subtree"
Set objRecordset = objCommand.Execute
While Not objRecordset.EOF
Wscript.Echo objRecordset.Fields("Name").Value
objRecordset.MoveNext
Wend