Microsoft KB Archive/118789

{| = FIX: Group Totals Are Incorrect in Report Writer =
 * width="100%"|

ID: Q118789

2.5x 2.6x | 2.5x

WINDOWS  | MACINTOSH kbprint kbprg kbfixlist kbbuglist The information in this article applies to:


 * Microsoft FoxPro for Windows, versions 2.5x, 2.6x
 * Microsoft FoxPro for Macintosh, versions 2.5x

SYMPTOMS
When you print or preview a page out of sequence in the Report Writer, the group total reports the value from the previously processed record instead of the actual group total.

WORKAROUND
See "Workaround" in the "More Information" section below.

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Visual FoxPro 3.0 for Windows.

Steps to Reproduce Problem
1. Create a new report.

2. USE the INVOICES.DBF table.

3. Create a data grouping based on CNO+STR(INO).

4. In the Group Info dialog box, select "New Page (Page No. =1)" and "Reprint Header On Subsequent Pages".

5. Place CNO and INO in the group header band as separate fields.

6. Place IDATE and ITOTAL in the Detail band.

7. Place an expression, ITOTAL, in the group footer band. Choose the Calculate check box, and then select Sum. Reset the grouping at the CNO+STR(INO) group level.

8. From the Report menu, choose Page Preview.

Note that the total on page 1 is correct.

9. Using the spinner next to Page, select page 15.

Note that the ITOTAL field in the Detail band and the ITOTAL field in   the group footer band do not match. 10. Look at page 14. Note that the ITOTAL field in the Detail band is the same as the ITOTAL field in the group footer band on page 15. This same behavior occurs when only selected pages are printed. If you display or print pages 1-15 sequentially, all the totals are correct.

Workaround
1. Do steps 1-6 above.

2. Create an expression in the group footer band that calls a user-defined

function (UDF) as follows:

pSUM(cno+STR(ino),RECNO) 3. Create the UDF PSUM.PRG file as follows: * PSUM.PRG * ---  PARAMETERS mGrouping, mSavRec SUM itotal FOR cno+STR(ino) = mGrouping TO mRetval GOTO mSavRec RETURN mRetval * -  * EOP PSUM.PRG 4. Preview or print the report. The totals are correct at any point. Additional reference words: vFoxwin Fixlist3.00 FoxMac FoxWin 2.50 2.50a 2.50b 2.50c 2.60 2.60a buglist2.50 buglist2.50a buglist2.50b buglist2.50c buglist2.60 buglist2.60a RWriter KBCategory: kbprint kbprg kbfixlist kbbuglist KBSubcategory: FxtoolRwriter

Keywords         : FxtoolRwriter kbbuglist kbfixlist Version          : 2.5x 2.6x | 2.5x Platform         : MACINTOSH WINDOWS Solution Type    : kbfix
 * }