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!

How to conditionally control textbox text in Header

Status
Not open for further replies.

olichap

Programmer
Mar 20, 2001
389
US
I've a report that executes 4 stored procs. Basically it's 4 different activity breakdowns of a vendor's activity.

The user selects a Companyname from the input parameters Label; the value is the CompanyID.

I'm trying to assign the CompanyName to a textbox in the report header. Right now it's based upon the "first(reportitems!company_2.value)" where company_2 is the Company column of the first grid's detail row.

The problem is that the first grid could return no results. It's even possible that all four grids would have no results returned. I'd still want to print the selected CompanyName at the top. So I'm looking for some way to assign the text of the selected CompanyName to a variable, or a better way to access it.

Any suggestions?

Thanks,

O.
 
Print the actual parameter value. Right click your text box, choose expression, open up Parameters and append that into the box. This way, regardless of a NULL dataset, it should still return the chosen value of the parameter.



Catadmin - MCDBA, MCSA
"If a person is Microsoft Certified, does that mean that Microsoft pays the bills for the funny white jackets that tie in the back???
 
The parameter used in the report is the CompanyID. When I give the user a dropdown to select the company they see the name as the text but the id is assigned to the parameter.

In the end I simply created another dataset to return the company name since I couldn't always rely upon a First(dataset!fieldname.value).
 
Or you could have done an If/Else statement in the expression to test the value of the parameter and match it up to it's proper name.

I'm glad you got it to work, though.



Catadmin - MCDBA, MCSA
"If a person is Microsoft Certified, does that mean that Microsoft pays the bills for the funny white jackets that tie in the back???
 
Thanks Catadmin,

Yeah, I tried playing around with IF and IIF statements but couldn't get things to work quite right. The IF statement was based upon a field that appears in all of four grids on the form. However not every grid will have data, thus the conditional.

Since this was my first RS report and had to be out the door quickly I had to settle on grabbing another dataset. I'm not a big fan of grabbing data un-necessarily so shall get back to working on the expression when things quiet down a bit.

Thanks again,

O.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top