[AccessD] Classes, Recordsets, and problems inbetween

Jim Lawrence (AccessD) accessd at shaw.ca
Mon May 12 04:28:08 CDT 2003


Marcus:

Have you declare your class?

Jim

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Marcus
Tewksbury
Sent: Sunday, May 11, 2003 7:49 PM
To: accessD at databaseadvisors.com
Subject: [AccessD] Classes, Recordsets, and problems inbetween


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

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list