Why doesn't RecordSet.MoveLast work? 
Author Message
 Why doesn't RecordSet.MoveLast work?

When my routine got stuck in an endless loop, I narrowed it down to this
simple test.
FRS.EOF always is FALSE! Shouldn't .MoveLast cause .EOF to be true?
What am I missing?

Here is my code:

Private Sub listAvailFiles_Click()
Dim DBfiles As Database
Dim FRS As Recordset
Set DBfiles = OpenDatabase("c:\program files\microsoft visual
studio\vb98\dpsFTP.mdb")
Set FRS = DBfiles.OpenRecordset("Files", dbOpenDynaset)
    FRS.MoveLast
    Debug.Print FRS.EOF
End Sub

All responses will be appreciated.
Terry



Sat, 27 Jul 2002 03:00:00 GMT  
 Why doesn't RecordSet.MoveLast work?
Terry,

MoveLast moves to the last record in the recordset.  You won't reach EOF
until you movenext after you are on the last record.

It works the same in the other direction.  MoveFirst moves to the first
record in the recordset.  Then a moveprevious after you are on the first
record will cause you to reach BOF.

Hope this helps,

Kerry Moorman

Quote:

>When my routine got stuck in an endless loop, I narrowed it down to this
>simple test.
>FRS.EOF always is FALSE! Shouldn't .MoveLast cause .EOF to be true?
>What am I missing?

>Here is my code:

>Private Sub listAvailFiles_Click()
>Dim DBfiles As Database
>Dim FRS As Recordset
>Set DBfiles = OpenDatabase("c:\program files\microsoft visual
>studio\vb98\dpsFTP.mdb")
>Set FRS = DBfiles.OpenRecordset("Files", dbOpenDynaset)
>    FRS.MoveLast
>    Debug.Print FRS.EOF
>End Sub

>All responses will be appreciated.
>Terry



Sun, 28 Jul 2002 03:00:00 GMT  
 Why doesn't RecordSet.MoveLast work?

Terry,

     No.
     MoveLast() only makes the last row in the RecordSet the active
     row, usually in anticipation of last-first processing back up the
     recordset.  The .EOF property is set when you then MoveNext() past
     the last row (and similarly .BOF is set when you move prior to the
     first row).  All of this, of course, makes for easy sequential
     processing of the rows in the recordset, as in :

     Set rsData = OpenRecordSet( . . . )
     Do While Not rsData.EOF
         ' Do something useful
         rsData.MoveNext
     Loop
     rsData.Close

HTH,
    Phill  W.

Quote:

> . . . Shouldn't .MoveLast cause .EOF to be true? . . .



Sun, 28 Jul 2002 03:00:00 GMT  
 Why doesn't RecordSet.MoveLast work?
Thanks, Kerry. That makes sense.
Terry
Quote:

> Terry,

> MoveLast moves to the last record in the recordset.  You won't reach EOF
> until you movenext after you are on the last record.

> It works the same in the other direction.  MoveFirst moves to the first
> record in the recordset.  Then a moveprevious after you are on the first
> record will cause you to reach BOF.

> Hope this helps,

> Kerry Moorman


> >When my routine got stuck in an endless loop, I narrowed it down to this
> >simple test.
> >FRS.EOF always is FALSE! Shouldn't .MoveLast cause .EOF to be true?
> >What am I missing?

> >Here is my code:

> >Private Sub listAvailFiles_Click()
> >Dim DBfiles As Database
> >Dim FRS As Recordset
> >Set DBfiles = OpenDatabase("c:\program files\microsoft visual
> >studio\vb98\dpsFTP.mdb")
> >Set FRS = DBfiles.OpenRecordset("Files", dbOpenDynaset)
> >    FRS.MoveLast
> >    Debug.Print FRS.EOF
> >End Sub

> >All responses will be appreciated.
> >Terry



Sun, 28 Jul 2002 03:00:00 GMT  
 Why doesn't RecordSet.MoveLast work?
Thanks, Phill, that does make sense.
Terry
Quote:

> Terry,

>      No.
>      MoveLast() only makes the last row in the RecordSet the
>      active row, usually in anticipation of last-first processing
>      back up the recordset.  The .EOF property is set when you
>      then MoveNext() past the last row (and similarly .BOF is set
>      when you move prior to the first row).  All of this, of
>      course, makes for easy sequential processing of the rows in
>      the recordset, as in :

>      Set rsData = OpenRecordSet( . . . )
>      Do While Not rsData.EOF
>          ' Do something useful
>          rsData.MoveNext
>      Loop
>      rsData.Close

> HTH,
>     Phill  W.


> > . . . Shouldn't .MoveLast cause .EOF to be true? . . .



Sun, 28 Jul 2002 03:00:00 GMT  
 Why doesn't RecordSet.MoveLast work?
.MoveLast means that you are on the Last record, therefore, EOF is false. If
you try to do a movenext when you are on the last record, then EOF is set to


Quote:
> When my routine got stuck in an endless loop, I narrowed it down to this
> simple test.
> FRS.EOF always is FALSE! Shouldn't .MoveLast cause .EOF to be true?
> What am I missing?

> Here is my code:

> Private Sub listAvailFiles_Click()
> Dim DBfiles As Database
> Dim FRS As Recordset
> Set DBfiles = OpenDatabase("c:\program files\microsoft visual
> studio\vb98\dpsFTP.mdb")
> Set FRS = DBfiles.OpenRecordset("Files", dbOpenDynaset)
>     FRS.MoveLast
>     Debug.Print FRS.EOF
> End Sub

> All responses will be appreciated.
> Terry



Sun, 28 Jul 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Why doesn't RecordSet.MoveLast work?

2. recordset.movelast doesn't work

3. Why doesn't recordset.update work?

4. Cloning Recordsets - why doesn't it work

5. Why oh why doesn't this work?

6. Why LoadPicture() works on local pathes and doesn't work on the URLS

7. Code doesn't work, why?

8. Why doesn't this MAPISendMail work?

9. Why doesn't this button work?

10. SQL in VB doesn't work - why?

11. Why doesn't this work?

12. Why doesn't this work???

 

 
Powered by phpBB® Forum Software