Jan 27 2006, 11:52 AM
I have a report that contains 4 subreports. I have written code behind to not display titles for the subreports meeting certain criteria. My question is how to move the subreports from below those not displayed up to the top. In other words if the top two subreports are not being displayed I want to move the 3rd and 4th subreport up so there isn't a large space when the report prints.
Jan 27 2006, 02:29 PM
When I put my subrpts into the main, they are just 'really thin' . . . less then the height of these letters.
The subrpt print, they will expand . . .
Thus, if you stack the 4 subs close together and the first two don't print, the report reader won't know the difference.
Jan 27 2006, 02:45 PM
I thought that was a very good idea and tried it but the problem is that when the data in the subreports does display there need to be spaces between the subs. This causes a problem with just the bottom two subreports contain data.
But thanks for the suggestion. It was worth a try.
Jan 27 2006, 03:58 PM
Still working on this problem, I have placed 3 of the subreports in their own subreport. Can I code behind a subreport to have it not activate when certain conditions are met?
Jan 27 2006, 04:47 PM
Yes, you can . . . try the OnOpen of the report or even OnFormat in the detail sections.
I have a report that includes two subs . . .one for Approved projects and another for Pending.
I do some math on the main report that requires that if no approved projects exit, I have to write a 0 into a box (since the sub doesn't exist with no records) so the calc in the pending sub doesn't get an error for a null.
As far as the primary issue, there's no doubt that some object VBA code might be able to move the subs around but I haven't done that . . . but have seen some code here that does.
Maybe try some searches . . .
Jan 30 2006, 11:17 AM
Sounds good. Care to share your code for how to 'deactivate' the subreport if no data exists?
Jan 30 2006, 11:41 AM
Or is there a way in the properties or code behind to turn 'visable' to no. If I was able to turn the subreport's visible property to no I would be all set.
Jan 30 2006, 02:43 PM
If a subrpt has no records . . .it doesn't print . . .thus I don't think you'd need to set it to invisible.
If you have conditions, I haven't tried that yet . . . but in the On Open or On Format, since a subrpt does have a visible property, you could test using VBA code and make it invisible.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here