Hello Geoff,
Let's suppose we are dealing with invoices. You will create a cursor that contains a line for every line item of the invoices. The line items need to be joined with the invoice header table (and probably other tables as well) so that each row of the cursor also contains all of the information you want to print in the header and footer of each invoice. In my case, the order by clause of my select statement is:
order by invNum, lineNum
Add a data group to the report on invNum. Check 'Reset page number' if necessary (you would do this for invoices).
Add a variable to the report, called lEndOfInvoices (or lEndOfGroup). Value to store: .f., initial value .f., calculate nothing, reset at invNum.
In the group footer, add a field to the report, and put the following in the expression. Also under, the Print When button, check 'Remove line if blank':
_vfp.setvar("lEndofInvoice",.t.)
Now, use the page footer as your group footer. If you want to indicate that the group continues on the next page, add a field saying so, and under "Print When" put !lEndOfInvoice in "Print only when expression is true". For the items you only want to print at the end of the group, put lEndOfInvoice in the print when section.
Let me know if I left out any important details...
HTH,
steve
>Hi There
>
>Sounds like a better scheme. I assume you us a numeric counter (eg nGpItem+1 as the value to store) and an initial value of zero. Then test for nGpItem=0 which should be the case at the end of the group.
>
>Perhaps you have another method???
>
>I would be interested in hearing how you achieved it!
>
>Regards
>Geoff Scott
>
Steve Gibson