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 can I change a formula entered in the Section Expert at run time? 1

Status
Not open for further replies.

MikeVE

Programmer
Apr 13, 2002
16
GB
I am using the RDC with VB.net. I have a subreport which is in a Group Footer of the main report. The subreport has two levels of grouping and NewPageAfter true on both levels. I get a unwanted final page with no data - just the main report's PageHeader. I can fix this using the Section Expert formula editor (GroupHeader NewPageAfter - Not OnLastRecord) for both groups.

My problem is that I need to do this at run time but I can not figure how out where the code goes or what objects and properties to use.

 
Something like this...
Code:
crxRpt.Sections("GH").ConditionFormula(crSectionAreaEnableNewPageAfterConditionFormulaType) = "not OnLastRecord"

... would set the conditional 'New Page After' formula for the Group Header at runtime to 'not OnLastRecord'.

I haven't used the RDC with .NET, but I imagine the RDC object model is the same for .NET as it is in VB6.

-dave
 
Thanks Vidru

That worked a treat when I put it in the code that first runs the report - all the pagination was just as I want it.

Next problem: I have some option buttons which allow the user to change the make up of the report - including pagebreaks. The code runs but the changes to the page breaks are not visible unless I click the Refresh button on the crystal toolbar. I have tried putting in .Refresh as well as .View report in the code but they do seem to activate the newly set ConditionFormula. I do not want the user to have to click the Crystal Reports refresh button as well as my option button. Any ideas?
 
Me again

I worked it out. I moved the code around so that the whole report is recreated every time I change an option and it all works.

Thanks again Vidru.

 
That's pretty much what I thought you'd have to do. I wasn't going to reply until I'd given it a little more thought.

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top