Keeping a Running Total Many applications such as a checkbook may need to keep a running balance of all transactions. This example shows how to keep such a running balance by using the @XLOOKUP and @NUMBER functions. In this example we will use the following fields: Check #: numeric field Check amount: money field Deposit amount: money field Current Num: numeric field Previous Bal: money field Current Bal: money field Other fields may be added, but these are all that will be used for the calculations. Select Speed up searches from the Customize Menu and put an S in the Current Num field. Enter the following on the Program Spec: Check #: #1 Check amount: #2 Deposit amount: #3 Current Num: <#4: IF #4 = "" THEN #4=@NUMBER; GOTO #5 PreviousBal: <#5: #5 = @XLOOKUP(@FILENAME, #4-1, "Current Num", "Current Bal"); GOTO #6 Current Bal: <#6 = #5 - #2 + #3 When adding new records, the balance from the last entered record will be placed in the Previous Bal field of the new record. The Current Bal will be calculated depending on the check or deposit amounts. Caution: Do not escape from a form if the Current Num field has been filled in. Instead enter a form with a Check amount of zero (0) and no check #. If the Current num field skips a number there will be no value for the Xlookup statement to match and the Previous Bal will become zero. Application: A checking account could use this to keep a running balance. Q & A Application Note Rev. 6/92 #2201 Page 1 of 1