Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Sum to textbox
Message
From
18/11/2000 13:31:53
 
 
To
18/11/2000 12:00:26
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00443370
Message ID:
00443380
Views:
13
Hi John.

>> What >I'd like it to do, is display the sum amount of a price
field into a textbox, and be able to refresh whenever
I change or update a record. <<

Off the top of my head (read that as UNTESTED < s > ):

Create a form property called nTotalPrice. Bind your textbox to that. Create a method called DisplayTotal. Call it from the Valid of the text box in the grid that contains the price. Code in DisplayTotal:
LOCAL lnRecNo
lnRecno = RECNO( '< grids's RecordSource >' )
SUM < the price field > TO Thisform.nTotalPrice
GO lnRecNo IN < the RecordSource >
Thisform.txtTotalPrice.Refresh()
You will also want to call DisplayTotal whenever you change customers. The scope clause of the SUM command depends on your grid's RecordSource. Hopefully you are using a parameterized view for that and not a filter.

You do not want to use a SQL SUM because SQL operates in the contents of the table on the disk and does not see the changes in the buffer.

Marcia
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform