NextRecord and ObjectPtr?

Joakim Schramm joakim at astrocalc.com
Sun Apr 30 13:18:27 CDT 2006


I think NextRecord is broken in COM,

With Tbl
.LastRecord
Do while Not Cbool(.BOF)
...
...
.PrevRecord
Loop
End With

Works, but not the other way around. I know the code above misses 1 rec but
it's just to show.

Joakim

> -----Original Message-----
> From: valentina-bounces at lists.macserve.net 
> [mailto:valentina-bounces at lists.macserve.net] On Behalf Of 
> Joakim Schramm
> Sent: 30 April 2006 13:07
> To: 'Valentina Developers'
> Subject: NextRecord and ObjectPtr?
> 
>  Hi,
> 
> Why does the (VB6) code below not work? NextRecord does't do 
> anything just stay on same RecId 1, so field references etc. 
> never gets updated etc. does COM object don't work with With 
> ... End With?
> Dim IdRec As Long
> Dim B As Boolean
> Dim sKey As String
> Dim fldPtr As VField
> Dim fldFK As VField
> Dim fldPK As VField
> Dim mTblCountry As VTable
> Dim mTblAlias As VTable
> 
> 'prepare binary links
> 'Set mLinkCA = mDatabase.Link(lnkCountryAlias) Set 
> mTblCountry = mDatabase.Table(tblCountry & sLang) Set 
> mTblAlias = mDatabase.Table(tblCountryAlias)
> 
> With mTblAlias
>     Set fldPtr = .Field("PtrAlias")
>     Set fldFK = .Field("CID")
>     Set fldPK = mTblCountry.Field("CID")
>     Call .FirstRecord
> 
>     Do While Not .EOF
>         sKey = Trim$(fldFK.Value)
>         IdRec = fldPK.FindSingle(sKey)
> 
>         If IdRec <> 0 Then
>             fldPtr.Value = IdRec
>             .UpdateRecord
>         Else
>             MsgBox "No " & sKey
>         End If
> 
>        B = .NextRecord
>     Loop
> 
> End With
> 
> Only part working is
> 
>         sKey = Trim$(fldFK.Value)
>         IdRec = fldPK.FindSingle(sKey)
> 
>         If IdRec <> 0 Then
>             fldPtr.Value = IdRec
>             .UpdateRecord
>         Else
>             MsgBox "No " & sKey
>         End If
> 
> What am I doing wrong?
> 
> Regards,
> 
> Joakim
> > -----Original Message-----
> > From: valentina-bounces at lists.macserve.net
> > [mailto:valentina-bounces at lists.macserve.net] On Behalf Of Ruslan 
> > Zasukhin
> > Sent: 30 April 2006 09:12
> > To: valentina at lists.macserve.net
> > Subject: Re: Table structure?
> > 
> > On 4/30/06 5:13 AM, "Joakim Schramm" <joakim at astrocalc.com> wrote:
> > 
> > > Not really me either, I removed keys and imported and it
> > dropped from
> > > 500+ to 42Mb, I added keys again and now only 75Mb instead
> > of 500+ -
> > > very strange. There must have been some big baloon of air
> > somewere in
> > > memory/cache maybe? I noticed when doing 500+ Mb db it 
> didn't flush 
> > > until it was ready, if it can say something. I have big
> > memory 2GB so
> > > maybe Valentina felt too comfortable :-)
> > 
> > No, flush, cache, RAM do not affect size of db.
> > 
> > Strange
> > 
> > --
> > Best regards,
> > 
> > Ruslan Zasukhin
> > VP Engineering and New Technology
> > Paradigma Software, Inc
> > 
> > Valentina - Joining Worlds of Information 
> http://www.paradigmasoft.com
> > 
> > [I feel the need: the need for speed]
> > 
> > 
> > _______________________________________________
> > Valentina mailing list
> > Valentina at lists.macserve.net
> > http://lists.macserve.net/mailman/listinfo/valentina
> > 
> 
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
> 



More information about the Valentina mailing list