
Blank Record at the end of the file?
Quote:
>called 'Previous Record' and 'Next Record' to instead of it. I wrote
>these codes:
> if not data1.recordset.eof then data1.recordset.movenext
>for the 'Next Record' button, and,
> if not data1.recordset.bof then data1.recordset.moveprevious
>but the problem is, when I use these two buttons and reach the
>beginning of the database file, there seems a blank record. Do you
Philip, when you say "seems a blank record", I take it that there isn't
actually a blank record. What you are doing is moving to EOF and BOF.
Unless you have a pressing reason for wanting to be sitting on EOF or BOF,
I think the following might work better.
data1.recordset.movenext
if data1.recordset.eof then
data1.recordset.moveprevious
end if
======
data1.recordset.moveprevious
if data1.recordset.bof then
data1.recordset.movenext
end if
======
This way you never move past the last record or prior to the first one (or
at least you don't appear to).
Probably it is also a good idea to precede both of these with a test for
an empty file. - ie -
if not (data1.recordset.eof and data1.recordset.bof)
make your move
end if
Take care
Alan