Sample Code for Summing a Field in a Database (114253)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft FoxPro for Windows 2.5
- Microsoft FoxPro for Windows 2.5a
- Microsoft FoxPro for Windows 2.5b
- Microsoft FoxPro for Windows 2.6
- Microsoft FoxPro for MS-DOS 2.0
- Microsoft FoxPro for MS-DOS 2.5
- Microsoft FoxPro for MS-DOS 2.5a
- Microsoft FoxPro for MS-DOS 2.5b
- Microsoft FoxPro for MS-DOS 2.6
- Microsoft FoxPro for Macintosh 2.5b
This article was previously published under Q114253 SUMMARY
FoxPro does not provide a function that sums a field in a database. The
closest FoxPro comes is the command SUM <field> TO memvar. Although this
command is useful, you may need to call a function that will sum a field
for a given condition.
The sample code below is a user-defined function (UDF) that can sum a field
in any specified table for any given condition.
Modification Type: | Major | Last Reviewed: | 12/3/2003 |
---|
Keywords: | kbcode KB114253 |
---|
|