PRB: "Division by 0" with SET FILTER Condition on BROWSELast reviewed: June 27, 1995Article ID: Q117707 |
The information in this article applies to:
SYMPTOMSUsing 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 BROWSEand then press the PAGE DOWN key to get to the bottom of the listing, you will receive the following error message:
Division by zeroNOTE: 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.
CAUSEUnder 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.
RESOLUTIONChange 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
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |