Click to See Complete Forum and Search --> : Recordset as parameters


kjoter
October 15th, 2001, 08:33 AM
Thank you for good answers earlier.

Is it possible to a whole recordset as a parameter in VB? I am trying to send a recordset as a parameter when i am starting a new application.. Do someone know how?

K.

Iouri
October 15th, 2001, 08:37 AM
You can create recordset as a function

Private Function myFunc(...any parameters to pass...) As ADODB.Recordset

...process stuff

Set myFunc = rsSomeRecordsetCreated
End Function


call it as:

Dim rs As ADODB.Recordset
Set rs = myFunc(...)



Iouri Boutchkine
iouri@hotsheet.com

Iouri
October 15th, 2001, 08:39 AM
Here is the code how you can send rs as parameter

private Sub Form_Load()
Dim rstTemp as new ADODB.Recordset
rstTemp.CursorLocation = adUseServer
rstTemp.CursorType = adOpenForwardOnly
rstTemp.LockType = adLockReadOnly

UseRecordset(rstTemp)

rstTemp.Close
set rstTemp = nothing
End Sub

public Function UseRecordset(Recordset as Object)

'Check if this is Recordset
If Not TypeOf Recordset is ADODB.Recordset then Exit Function

'Do Sth with Recordset
Recordset.AddNew
'
'
'
Recordset.Update

End Function



Iouri Boutchkine
iouri@hotsheet.com