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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Parameter to Subreport

Status
Not open for further replies.

wilbur00

Programmer
Dec 9, 2004
16
US
Hello -

I'm using Crystal 8 and MS Access 97. I have a grouped report that summarizes calls by employee. There are 3 types of calls. The first 2 types of calls are read from the same table and just have a different type code. The third type of call comes from a totally different table and uses different criteria to summarize the data. The users want a summary of # of calls by type all in the same row with percents entered/completed at the end of the row and totals at the bottom of the column.

Here's a visual:
(Call Type 1) (Call Type 2) (Call Type 3)
Entrd|Cmpl|Goal|%Cmpl Entrd|Cmpl|Goal|%Cmpl Entrd|Cmpl|Goal|%Cmpl
Employee 1
Employee 2
Employee 3
Totals

Call Type 3 uses different criteria to summarize the data and can have duplicate records (which they only want to count distinct records).

My problem is that I cannot figure out how to use the main report dates (parameters - Start Date and End Date) in the Call Type 3 sub report. I need to be able to set up select criteria in the subreport where my records are between the start and end date, but it doesn't let me compare the date in the subreport records to a variable (it just gives me actual data (dates) to pick from).

My current select criteria in the subreport is:
{Distinct_WBA_per_ENUM.Enum} = {?Pm-USysEmployees_Table2.Employee_Number} and
not ({Distinct_WBA_per_ENUM.Status} in ["Canceled", "Complete"])

I'd like to add Distinct_WBA_per_ENUM.Submitted_Date between ?Start_Date and ?End_Date.

I've tried setting up shared variables for the start/end dates;
Main:
WhilePrintingRecords;
Shared DateVar EndDate := {?EndDate}

Subreport:
WhilePrintingRecords;
Shared DateVar EndDate;
EndDate

But the subreport does not let me select the shared variable when trying to set up select criteria for my submitted_date field (I want to make sure the submitted_date is between StartDate and EndDate)

I've tried linking the subreport and get this in the group selection formula of the subreport:
{@StartDate} = {?Pm-?StartDate}
{@EndDate} = {?Pm-?EndDate}
with the error "The remaining text does not appear to be part of the formula"

I'm totally stuck and I think as I work on this I'm getting more confused! Any help would be appreciated.

Thank you!
 
Sounds like your link parameters are simply not the right data type.

By the way, a more elegant way to solve the whole thing is to use a UNION statement whereby the (distinct) data from the 2nd data source would be appended to the data from the 1st data source.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
I would create the same parameters in the subreport and use them in the record selection formula of the subreport, just as you did in the main report. Then link the subreport by the parameters. In the main report->edit subreport links, add the main report {?start} and then use the drop down on the lower left to choose the subreport parm {?start}--NOT the {?pm-?start} that appears before using the dropdown. Then repeat for the end date parm.

-LB
 
Good morning. Thank you for your responses. I have a couple of questions:

IdoMillet: You suggested a UNION statement. Where do I set up the UNION? Would it be outside of Crystal?

Lbass: I'm still trying to get what you suggested to work and will email back if I can't figure it out.

Thank you both for your time and suggestions.
 
Since you are using Access, the easiest approach (given that you are using Cr 8) is to create the UNION quesry in Access. This query will then appear within Crystal as if it's one of the tables that you can select as a data source.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top