PDA

Click to See Complete Forum and Search --> : Passing Recordsets to Functions


lenin
Aug 22nd, 1999, 03:19 PM
Hi,
can anyone point out what is wrong with the following code. What I want to do is pass a complete rcordset to a function. When I run it I get a type mismatch error.

Thanks in advance.

Tony.


Public Sub do_report()

'Get the recordset for all customers
Dim lrs_customer_number as adodb.recordset
Call de.customer_id
Set lrs_customer_number = de.rscustomer_id

lrs_customer_number.MoveFirst

Do Until lrs_customer_number.EOF
getNextCustomerNumber (lrs_customer_number)
Loop


End Sub

Public Sub getNextCustomerNumber(customerNumberRecordset As Recordset)

MsgBox lrs_customer_number.Fields("num")

End Sub

jim
Aug 23rd, 1999, 12:44 AM
Don't call a Sub that returns nothing with parens around the arguments.

Use

getNextCustomerNumber lrs_customer_number

instead of

getNextCustomerNumber (lrs_customer_number)