Results 1 to 2 of 2

Thread: Passing Recordsets to Functions

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 1999
    Location
    Belfast
    Posts
    254

    Post

    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

  2. #2
    Junior Member
    Join Date
    Jun 1999
    Location
    Papillion, NE, USA
    Posts
    21

    Post

    Don't call a Sub that returns nothing with parens around the arguments.

    Use

    getNextCustomerNumber lrs_customer_number

    instead of

    getNextCustomerNumber (lrs_customer_number)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width