Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi Pass Report?

Status
Not open for further replies.

ClarkJeff

Programmer
Feb 28, 2002
46
US
I need to create a Stock Trade report showing the Buys of stocks grouped together first, then the further down the page, the Sells of stocks grouped together . Both the buy and sell information is contained in the same data record. How can I get CR to read through the file displaying all of the Buy information, then read through again, displaying all of the Sell information? I couldn't figure out how to Group the records so that they would appear both times. I'm calling the CR from within VB and have tried to use subreports, but couldn't figure out how to get the Page Headings to repeat properly and how to change to a different database at runtime (while using subreports). Thanks for any help!
 
A report can't use a single record twice - you need to have two copies of the record, or use a subreport. If you are calling the report from VB you should be able to build a recordset that has 2 copies of all records marked so that they can be grouped in separate groups.
Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Ken is correct - you can't have a record appear twice.

If you have SQL to access your data use the DB or the CR SQL designer to create a doubled record set with a UNION join.

Select 'BUY' as rectype, BUYDate as MyDate, field1, field2, field3 from STOCKTABLE
UNION ALL
Select 'SELL' as rectype, SELLDate as MyDate, field1, field2, field3 from STOCKTABLE

The use this as the source for your report.

In my experience the problem with a subreport is there may be days when you didn't buy, and only sold, or the other way around. Subreports only work if you always have days when both events occur.
Editor and Publisher of Crystal Clear
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top