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!

Yet another Parameter Question!

Status
Not open for further replies.

McNab

Programmer
Jul 23, 2001
101
CA
Hello All,

I have a sub report in my main rpt. I use a parameter to link them. I'm not quite sure how I got them to work, I just kinda played with it until it worked. Now I have added another subreport to my report. I wish to use the same parameter to link it as well. The whole point is to only enter the NameID into the selection criteria in the main report, then have the subs run off of that. Could you explain plz!

Thx
Jamieson McNab Leitch
 
WoW,

It seems the more I play with it, the more broken it becomes. Now I have lost the data from both subreports. I'm really not sure what to pick from the main. I put the new param in the new sub, went to the main and right clicked and went to link sub options. There is a drop down box there with both sub rpt names in it, however, the new sub has no parameter in the drop down box. It does exist and is sitting on the form. Last time I ended up eraseing the param I made in the first sub rpt. Crystal made it's own param and I erased the one I made and it worked well. No prompting for param selection criteria which is what I want. Help me ... I'm drowning ... glug!!

Jamie
 
This is a case of CR being so 'helpful' that it muddies the water.

To link you need three things.

1) A parameter in the sub
2) A use for that parameter, like the selection formula
(but it can be used for other things as well)
3) A link between that parameter and the main report, made on the links tab in the main report.

Since your situation is the most common use of a link, selecting an "equal to" value, CR can do your situation automatically.

If you didn't add the param in the Sub, when you got to the links tab while adding the sub you can select the field from the main report. CR will then automatically add the parameter and the "Equal to" rule in the subreport. You just select the appropriate field to select on in the main and sub reports.

The alternative is the more flexible and makes it clear what is happening:

1)Add your own parameter to the subreport.
2) Use it in the selection formula
3) When you add the subreport, on the links tab you skip the parameter that CR wants to add, and select your own parameter from further down in the drop down list. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Thx so much Ken,

You really described the solution well! I'm always hopeful that you will be the one to reply to my posts! I'll give it a shot and see what happens.

Thx again...

Jamie
 
Hey Ken,

A quick question about what you said...

3) A link between that parameter and the main report, made on the links tab in the main report.

3) When you add the subreport, on the links tab you skip the parameter that CR wants to add, and select your own parameter from further down in the drop down list.

Where is this "links tab" in the main? In the Report Expert, the link tab is the Visual Linking Expert. This is only tables and their fields, no param's.

I'll keep trying ...

Thx

Jamie
 
Ok ... I got the new sub to work. CR made a param for it, problem is that it seems to have taken the param from the other sub. Now it doesn't work but the new sub does? I guess you can't use the same param in 2 subs. I have 2 subs and I just want them to get data based on one NameID from the main ... that's it ... that's all!

Thx

Jamie
 
It seems as if I can only have one linked param (to a sub) at once? Is this the case? Once I set one up, CR erases the other?

D'oh!

Jamie
 
ON the subreport LINKS tab, move the container field over twice, once for each subreport. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Hey Ken,

Earlier, you told me to:

1. Create a parameter in the sub
2. Have a use for it (like the selection crit)
3. A link between the param and the main rpt, made on the links tab in the main rpt.

for #2, Once I have created the param, I cannot put it in the selection crit? I have:

NameEntity.NameID is equal to ?Sub1NameID

this gives me an error of "A number, currency amt, boolean or string is expected here"

What you outlined to do seems pretty straight forward, but I can't use the param in the select crit for the sub?

Help!

Thx

Jamie
 
Try using = instead of words:

{NameEntity.NameID} = {?Sub1NameID}

If this doesn't work, confirm that the field and parameter are the same data type. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top