Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate the total.
Message
From
23/02/2001 11:28:56
 
 
To
23/02/2001 08:39:02
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00478403
Message ID:
00478894
Views:
29
>Bill:
>
>>>>
>This depends on what you want to sum. If you have, say, 3 numeric columns for which you want to create a fourth column that is the sum of the other three, you can use a SELECT statement like:
>SELECT fld1, fld2, fld3, fld1 + fld2 + fld3 AS MySum ...
>to get a sum of the columns for each row. This requires creating a cursor from the SELECT and binding the cursor to the grid.
>>>>
>
>A simpler solution is to set ControlSource to fld1+fld2+fld3 and to make that column read-only. If you create a read-write cursor the way you suggest, the sum will not be updated when you change the value of fld1, fld2, or dld3.
>
>Daniel

As always there is more than one way of dealing with an issue. Unless I have specific need otherwise, I personally like dealing with cursors since they are highly manageable and provide automatic failsafe for unwanted table changes. Updating the summed field is no problem using events and might give more control in given circumstances. Always good to see more than one way of dealing with things.

Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform