0

I am querying Active Directory from VBA which returns a recordset.

I access the values returned in the recordset "rs" per the code below:

Set rs = cmd.Execute
adUser.Add "givenName", rs.Fields("GivenName").Value
adUser.Add "sn", rs.Fields("sn").Value

However one of the returned values, has the result in a nested "value" and I can not work out how to access the returned value. The ObjectWatch shows it like this:

enter image description here

I tried:

rs.Fields("postOfficeBox").Value(Item(0))

The value returned I am trying to access is Variant/String.

Similar question here without answer: VBA: Accessing Variant/String Array value

Al Grant
  • 2,102
  • 1
  • 26
  • 49
  • 1
    Try `rs.Fields("postOfficeBox").Value.Value(0)`. Left clicking the property will bring up a context menu that has an option to copy the property path. It may help. I would put a break after you load the dataset and fiddle with rs in the immediate window until i figured it out. Good Luck – TinMan Jun 05 '23 at 05:02
  • Please, put the code that you use to query active directory. I will try to reproduce your problem. – Tarik Jun 06 '23 at 00:56

0 Answers0