-
Passing Recordsets
Can any one tell me how to pass an open Recordset as a parameter? I have tried the following...
private sub SUB1()
'dim and open a rs called RS1
bResult = MyFunction(RS1)
'close recordset and move on
end sub
Public MyFunction(ByVal RS2 as ADODB.Recordset) as Boolean
RS2.open
'do something with the recordset
RS2.close
MyFunction = True
End Function
The RS2.Open fails to execute. If I move the call below the close recordset in SUB1 it works just fine. I have tried passing it ByVal and ByRef.
Any assistance would be appreciated!!
-
It fails when you try to open a recordset that is already open. You
open it in sub1, pass it to myFunction, then inappropriately you're opening it again with RS2.Open so remove that line.
Ralph
-
Thank you very much... it was too obvious and simple of a solution!!