Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using SUM, COUNT, etc. in a form with multiple tables
Message
De
04/11/1998 13:43:54
 
 
À
04/11/1998 13:34:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00154405
Message ID:
00154449
Vues:
17
>>>>I have a form with several tables in its data environment. If I want to use SUM to sum a field in one particular table, what should I do? (How can you specify the table in SUM command?) Is there any better way to get a sum of a field in a table without worrying working area while multiple tables exist in a data environment? Thanks in advance.
>>>You can use SQL to sum to an array. So won't worry about current workarea, rec pointer movement etc. ie: select sum(sumfld1), sum(fld2*fld3/3) into array aSums. Further you could set array elements as controlsources of textboxes that would show the sum (so no need for refresh too :).
>>>Cetin
>>
>>Thank you, Cetin. But is there any better way than using SQL? The reason for asking this is that I have multiple tables in the form. When SQL runs it changes the work area which is the whole point that I am trying to avoid.
>>
>>I use a field to show the currect sum of some records in a table(grid) which is editable on the form. In other words, I want to have a textbox on a one-to-many form. Whenever I add/delete/change records in the grid (detail table) or I move the records in the master table, the updated sum of related records in the detail table will be displayed in the textbox.
>
>
>If you SQL to an ARRAY, it does NOT change the selected area. This is what Cetin suggested that you do.
>
>Fred


Good point, Fred. Thank you. Cetin, thank you again.

Wei
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform