[AccessD] Classes, Recordsets, and problems inbetween

Marcus Tewksbury tewksbum at hotmail.com
Sun May 11 21:48:40 CDT 2003


Hi everyone,

Ok - here is my issue - I thought I'd be really fancy and start 
encapsulating my tables in data classes - using properites and all that good 
stuff.  One issue that I am having is trying to pass in recordsets (or other 
classes that also contain recordsets) into a class always gives me a Type 
Mismatch or 438 error.

The class files and code behind all reside in the same project.

Any thoughts?  I'm stumped!


Here are 2 snippets

    Dim oInvoiceDetail As New InvoiceDetail
    oInvoiceDetail.Load_byInvoiceID (Me.InvoiceID)

    Dim oOrderDetail As New OrderDetail
    oOrderDetail.Load_byInvoiceDetail (oInvoiceDetail) <-CRASHES HERE

    While Not oOrderDetail.EOF
        oOrderDetail.FilledFlag = False
        oOrderDetail.MoveNext
    Wend

and ...

Public Function Load_byInvoiceDetail(ByVal xInvoiceDetail As InvoiceDetail)

    Dim sstrSQL As String
    Dim sflgNotFirst As Boolean

    sstrSQL = "SELECT * FROM OrderDetail"

    While Not xInvoiceDetail.EOF
        If Not sflgNotFirst Then
            sstrSQL = sstrSQL + " WHERE OrderDetailID = " & 
xInvoiceDetail!OrderDetailID & ")"
            sflgNotFirst = True
        Else
            sstrSQL = sstrSQL + " OR (OrderDetailID = " & 
xInvoiceDetail!OrderDetailID & ")"
        End If
        xInvoiceDetail.MoveNext
    Wend

    With mrst
        .CursorLocation = adUseClient
        .CursorType = adOpenDynamic
        .LockType = adLockBatchOptimistic
        .Source = sstrSQL
        .Open
    End With

    Call Scatter

End Function

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus



More information about the AccessD mailing list