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

Parameter problem 1

Status
Not open for further replies.

WarrenTheWindmill

Programmer
Sep 8, 2000
18
GB
I am trying to create a report that contains 2 subreports.

I want to enter from and to dates at the level of the main report and have them used by both the subreports

The subreports are based on different tables but have the same column name, so I have renamed each of the tables as O as in O.fieldname.

I have created a from and to parameter in the main report, which does not link to a field but merely asks for a date.

I have then used the subreport links to link these parameters in the normal way.

If I run this report it does not return any data. If I run th sub reports separately the data appears as expected, so its as if the linking between the main and sub reports isn't working properly.

I've use parameters routinely without problems. Am I missing something obvious?

Help would be very much appreciated as I have run out of ideas!
 
Have you reviewed your record selection criteria within each of the subreports? Based on your statement above, your record selection criteria in the main report (if you even have record selection criteria at the Main Report level) may be something to the effect of:

{a.datefield} in {?FromDate} to {?ThruDate}

When you created your subreport links it was most likely from {?FromDate} linked to {?PM-?FromDate} and {?ThruDate} linked to {?PM-?ThruDate} and was probably based on the database fields {b.datefield} and {c.datefield} for the first and second subreports, respectively.

If you look in your record selection criteria for each of the subreports you'll see that Crystal didn't format the parameters in the record selection criteria in the manner you expected. Instead the record selection criteria that was generated via the subreport linkage is probably:

{b.datefield} = {?PM-?FromDate} AND
{b.datefield} = {?PM-?ThruDate}

for the first subreport and

{c.datefield} = {?PM-?FromDate} AND
{c.datefield} = {?PM-?ThruDate}

when you expected to see:

{b.datefield} in {?PM-?FromDate} to {?PM-?ThruDate} for the first subreport and
{c.datefield} in {?PM-?FromDate} to {?PM-?ThruDate} for the second subreport.

The key to remember is that whenever you create subreport linkages, you must always review the record selection criteria within each of the linked subreports to ensure that the record selection criteria is correct.

I hope this helps:)
 
Hi rhinok

Many thanks for your response.

I have checked all the record selection criteria for the sub reports and they are already in the form you outlined.

I can't see any reason why this shouldn't work, but it doesn't

 
I know it doesn't help but I am having a similar problem. Your words:

"If I run this report it does not return any data. If I run th sub reports separately the data appears as expected, so its as if the linking between the main and sub reports isn't working properly."

are exactly what I am experiencing also. I hope someone has solved this wierd one and answers you.

 
When in doubt read the instructions...

I checked Crystals' own help on this one and it states that 2 subreports should not be run from the shell of a main report (which contains nothing but the 2 subreports)

Rather you should make one of your sub reports, the main report and the second is a subreport from the main.

I did this and it worked fine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top