PDA

Click to See Complete Forum and Search --> : How do I pass a recordset as an argument to a function?


Marie
Jan 12th, 2000, 03:17 AM
How do I pass a recordset as an argument to a function?

JHausmann
Jan 12th, 2000, 03:55 AM
I don't, usually. I define my recordsets as globals and use them when/where needed.

Forest Dragon
Jan 12th, 2000, 03:57 AM
Are you using DAO, RDO or ADO? Anyway, in most of the cases, a recordset is an object of the class "Recordset". That means, that in order to pass it to a function, you need first to define the function:

Function Function1(Arg1 As Recordset,...) As ...

Then you need to pass the parameter:

Var1=Function1(RecSet,...)

Hope I helped you!!!

lenin
Jan 18th, 2000, 10:16 PM
Recordsets to my knowledge can be sent like any other parameter. I use ADO and have used it numberous times.

Example below.

Public Sub NextRecord(records As ADODB.Recordset)
If lb_recordsLoaded Then
If records.EOF Then
MsgBox "Already at last record"
Else
records.MoveNext
Call FillCustomerDetails(records)
End If
Else
MsgBox "No Records to Populate Form"
End If
End Sub