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

passing a value to a parameter in a subreport

Status
Not open for further replies.

ifthenelsenull

Technical User
Nov 17, 2011
31
US
I need to pass a value from the main report to a subreport's parameter. The main report pulls in all employees and the sub report is set up to return specific data to that employee using a parameter of their employee number.

The main report field is employee_id and the subreport parameter is @employee_id

When I create the sub report it runs fine but when I go to link it to the main report the parameter in the subreport is not available to be chosen so the main report ends up creating a second parameter in the subreport which then prompts twice instead of passing the data.

How can I pass data from a field in the main report to a parameter in a subreport aka "what am I doing wrong".
 
What is the content of the formula {@employee_id}?

Also, how does this display? How does the field display in the main report? They must match.

-LB
 
I don't have a formula do I need one? I just have the field employee.employee_id in the main report and the parameter @employee_id in the sub.
 
But parameters aren't identified by "@". If these are both fields, then please show samples of how each one appears.

-LB
 
Sorry in the SP they are defined that way.

In the main report it's just a field. {employee_id}

in the Subreport it's a parameter {?@employee_id}

I need to link [employee_id} in the main to {?@employee_id} in the sub. But when I choose {employee_ID} in the main it's not an option to choose {?@employee_id} instead it creates Pm-employee_id which doesn't pass to the parameters.

In the main report the datatype is INT the sub is a varchar if that matters at all.
 
I solved it. It was a datatype mismatch. Once I cast the types to match it worked as expected. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top