` Printed Icetips Article

Icetips Article



Par2: Detecting last record in a browse
1999-05-08 -- Jim Kane
 
>> Does anyone know of an elegant way to detect when the last record of a
>> browse is selected?

If you are not adding/editing/deleting you could retrieve the last record and save the 
primary key fields for a quick test. Else:

If Records(BRW1.ListControl)>Choice(Brw1.ListControl) then
   !not last
else
   get(Brw1.ListControl,Records(BRW1.ListControl))
   Reset(Brw1.View, Brw1.ViewPosition)
   If BRW1.Next()<>Level:benign !retrieve the last record in the list box
     !unexpected error
   end  
   case BRW1.Next() !get the record after the last one in the list box
   Of Level:Notify 
     !You were on the last one
   Of Level:Fatal
     !unexpected error
   Of Level:Benign
     !not on the last one
   end  
end



Printed November 21, 2024, 6:46 am
This article has been viewed/printed 35197 times.