Funcion f_ReturningCollection () as Variant
Dim l_Result as New Collection
Dim l_Items as New Collection
Dim l_Record as New Collection
' all the connection and the recordset is already prepared
Do While Not oRS.EOF
l_Record.Add oRS.Fields("Field1"), key:= "Field1"
l_Record.Add oRS.Fields("Field2"), key:= "Field2"
l_Items.Add l_Record
Set l_Record = Nothing
oRS.MoveNext
Loop
l_Result.Add l_items, key:="items"
Set f_ReturningCollection = l_Result
End Function
In the other side, just receive the collection and access the information,
Hope it helps,
Geoffrey Chu