Subject Re: [IBO] EOF BOF craziness
Author Daniel Rail
Hi,

At September 8, 2003, 11:44, Paul Hope wrote:

> Just place a TIB_Query, TIB_Dataset and TIB_Text on a form and link them up.
> Also 2 buttons (for next and prior).
> In the form OnCreate open the query. Under the first button put Query.Prior
> and the second put Query.Next.

> Using the Next/Prior will give the 'at end/beginning of dataset' error.

> then under the buttons put

> if not eof then next and if not bof then prior.

> You will notice that the IB_Text goes blank when each end is reached -
> because the current row (one past the end) is invalid.

> I need it to stop on the last/first valid record because in reality I am
> doing a lot more.

Try the following code examples:

For Next:
if not eof then
next;
{The "not bof" is to make sure the result set is not empty}
if eof and not bof then
last;

For Prior:
if not bof then
prior;
{The "not bof" is to make sure the result set is not empty}
if bof and not eof then
first;

These code examples will work with TIB_Query, but not with TIB_Cursor
because TIB_Cursor doesn't support the same methods.

--
Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)