Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Sum to textbox
Message
De
18/11/2000 13:31:53
 
 
À
18/11/2000 12:00:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00443370
Message ID:
00443380
Vues:
20
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform