ID: Q117707
The information in this article applies to:
Using the DOWN ARROW or the PAGE DOWN key to move the record pointer to the end of the database during a BROWSE generates a "Division by 0" error message.
For example, if you type the following commands in the Command window
USE <FoxPro_directory>\tutorial\salesman
SET FILTER TO MOD(10000,ytdsales) = 10000
BROWSE
and then press the PAGE DOWN key to get to the bottom of the listing, you
will receive the following error message:
Division by zero
NOTE: When the error occurs, FoxPro for MS-DOS and FoxPro for Macintosh
inform you that the filter has been cleared, whereas FoxPro for Windows
does not.
Under a normal BROWSE condition, one with no filter set, the end-of-file (EOF) marker is identified and the pointer is automatically moved back to the last record in the list. In this situation, nothing is requested to be evaluated, nothing is evaluated, and no error condition (of any kind) should be present.
However, in the example above, the filter is evaluating the EOF marker. The value of YTDSALES at that point is equivalent to zero (0). Therefore, division by zero takes place and the error message is displayed.
Change the filter condition to include an IIF() function. For example:
SET FILTER TO MOD(10000,IIF(ytdsales=0,1,ytdsales)) = 10000
Additional reference words: FoxMac FoxDos FoxWin 2.00 2.50 2.50a 2.50b
2.50c 2.60
errmsg
err msg
KBCategory: kbprg kberrmsg kbprb
KBSubcategory: FxprgBrowse
Last Reviewed: June 27, 1995