In VBA Programming I am trying to understand the state of a recordset when it is passes data from within a function to another recordset
for example
Sub Test()
Dim Recordset1 as new ABODB.Recordset
Set RecordSet1 = BringDataFromRecordset2()
Do while not Recordset1.EOF
'data do something
Recordset1.movenext
Loop
End Sub
Function BringDataFromRecordset2() as ADODB.Recordset
dim RecordSet2 as new ADODB.Recorset
RecordSet2.Open "Select * from DUAL", Connectionstring
BringDataFromRecordset2 = RecordSet2
End Function
What happens to RecordSet2 when it passes the data to RecordSet1 in line "Set RecordSet1 = BringDataFromRecordset2()?
Does it close alutomatically? if RecordSet2 is still open how do I close it?