Using VPLUS: An Introduction to Forms Design (32209-90004)

6-7
the statement shown in Figure 6-5. Press ENTER to record this field
definition.
Figure 6-6. Field Menu for ORDNUM in the TOTALS Form
Action
Now, go to the Field Menu for ORDNUM in the TOTALS form. As you did with
the similar field in the ORDER form, change the field type to D, the data
type to DIG, and delete the initial value. Then, go to the Processing
Specifications area of the menu and add the statements shown in Figure
6-6. Press ENTER.
The first time the ORDER form is displayed by ENTRY, the value of SORDNUM
is its initial value 100001. Since no change is made to the SORDNUM save
field between execution of the first form (ORDER) and the second form
(TOTALS), both forms for a single order have the same order number,
initially 100001.
The next time the ORDER form is displayed, it is for a new order. As a
result of the calculations in the ORDNUM field of the form TOTALS, this
number is 1 greater than the previous order number; that is it is 100002.
This continues until the order number is incremented to its maximum val-
ue
of 999999.
Note that the value of SORDNUM is tested before it is incremented. This
is done because the two ORDNUM fields and the SORDNUM save field are each
six digits long. A value greater than 999999 causes an overflow error
because it won't fit in these fields. To prevent such an error, the