>To make a long story short. We have a table that requires records to be subtotaled and printed twice and in different order on the report using two different sorting criteria to make two different columns. Something like this:
>
>
>A/C# Description Debit Credit
>---- ------------------------------ ---------- ----------
>560 Expense - Furniture & Fixtures 26.20
>562 Expense - Buildings 1,941.36
>564 Expense - Autos 117.14
>
>160 Acc/Depr - Furniture & Fixtures 26.20
>162 Acc/Depr - Buildings 1,941.36
>164 Acc/Depr - Autos 117.14
>
> --------- -----------
> 2,084.70 2,084.70
>
>We are hoping that we could produce the report using two separate cursors. What do you think?
>
>Thanks for the response,
>
>Tom
John & Tom,
The simplest method would be to make a cursor that has both debit and credit information, although with separate rows for each. Either use a UNION in a single SQL-Select or make 2 cursors and append one to the other. Each row would have both Debit and Credit fields, but either Debit or Credit would be empty ($0). Order the resulting table by first debit then credit. It may be simplest to have a field for this purpose. Finally, use the Print When on the Debit and Credit fields to tell the report when to print it.
Sample:
Select ACNum, Description, Debit, 00000.00 as CREDIT, '1' as DCOrder;
from DebitTable where InvNum = '1000';
UNION SELECT ACNum, Description, 00000.00 as DEBIT, Credit, '2' as DCOrder;
from CreditTable;
WHERE InvNum = '1000';
INTO cursor ReportTemp order by 5
Note that the cursor has all debit items first, then all credit items.
HTH
Barbara