Michael R Mattys
michael.mattys at adelphia.net
Sun May 11 22:09:37 CDT 2003
Marcus, Has mrst been set = to an ADO recordset in the Declarations section? Mike Mattys ----- Original Message ----- From: "Marcus Tewksbury" <tewksbum at hotmail.com> To: <accessD at databaseadvisors.com> Sent: Sunday, May 11, 2003 10:48 PM 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