PDA

View Full Version : Pass recordset parameter



dhartford
10-21-2008, 05:09 PM
Can we pass recordset to a function? May be not as recordset is not one of the data typies of VBA. Then I have to create a array, but the problem with array is that the data in an array has to be the same data type. I need to pass company name and money value to a function.

Thanks in advance.

Demosthine
10-21-2008, 05:40 PM
Good Afternoon Again.

Yes, you can pass Recordsets to a Function. First, you'll need to use Early-Binding, so declare a Reference to ActiveX Data Objects in your VBA Project. Then, you will have access to the Object Recordset.


' From calling procedure...
Print_Supplier rstResults

Private Function Print_Supplier(Results as Recordset) as Recordset
Debug.Print Results("Supplier").Value
End Function


Scott