Printing Blank Sections

Stemdriller

Registered User.
Local time
Today, 23:23
Joined
May 29, 2008
Messages
187
Hi Everyone,

I have a Report that consists of 4 Sub Reports (That fit onto one A4 print) and when printing if the sub reports have data to show then they print off without issue.

But when the sub report does not have any data then the report just creates a blank space where the sub report should be. I have played with the 'On no data'. I have even placed a label behind the report that says 'Not applicable', this works fine when there is no data, but when there is data the 'Not applicable' data still prints.

Any ideas of how I can get around this??

Thanks

Gareth:confused:
 
Set the Can Grow and Can Shrink properties of the subreport control to Yes.

Do you have page break controls on your report?
 
Both are set to Yes, and there are a couple of page breaks.

The problem is that there simply isn't a record for one of the sub forms, so what I am trying now is on the sub report place a label with text, but make it not visible. Then If PermitNumber IsNull the make label visible or something in that elk.

Gareth
 
Since you know the workings of the HasData property you need to hide the page break above the empty subform if it has no data. Then make it visible if it does.
 
OK

My Main Report is called rptViewPermit, within that Report is a subreport called rptHotWorkView.

Within rptHotworkView is a TextBox called 'PermitNumber'

When rptViewPermit opens I want it to check to see if there is a value in PermitNumber, if there is then make a label on rptViewpermit not visible.

I have tried

If (Me.rptHotWorkView.Permit) > 1 then
Me.label97.visible = False

and other variations, but alas it either errors or just doesn't make the label not visible.

Ooooh I could crush a grape sometimes

Gareth
 
I did mention using the HasData property of the subform.
 
Yes, sorry I couldn't find this 'Hasdata' property initially but have now

Have tried


Private Sub Report_Activate()
If (Me.frmHotWorkView.Report.HasData) Then

Me.Label97.Visible = False


End If
End Sub

This is on the Main Report (rptViewPermit)

Error now is
Run-Time error 2467

The expression you entered refers to an object that is closed or doesn't exisit.

Any ideas??

Gareth
 
Missing my point again. You hide the Page Break control ;) Plus Activate is not the event to use, you use the section's On Format event.
 
Yep, the wife keeps telling me I don't listen!

I have done what your have suggested but still the same error:mad:
 
Let me see your entire code. And could you please wrap it in code tags.
 
When the Print Button is selected it fires rptViewPermit. rptViewPermit has four Sub Forms all link by PermitNumber. If the forms have data they print just fine, if not they just leave a blank space.


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If Me.frmHotWorkView.Report.HasData Then

Me.Label97.Visible = False


End If
End Sub

So if it has data it prints if not the Blank space will have a label with defined text on (No data selected etc etc), which will become visible.

SOrry I don't no what 'Code tags' are

I really appreciate you trying to help me again, it is much appreciated.

Gareth
 
So you're saying it's still throwing an error?

As mentioned in my last post, you're still hiding the label when I mentioned you should be hiding the Page Break control.
 
Yes still throwing up the error 'The expression you entered refers to an object that is closed or doesn't exisit'.

There are no page breaks in the Details section of the report. I thought there were a couple behind the forms but alas I must of removed them.
 
Revised db attached. It throws up a few errors but still throws up the error.

Use Badge Number 999 and run frmViewPermit

Thanks alot

GW
 

Attachments

You embedded a form in your subreport? How did you think .Report.HasData will work? Reports should be in subreports and forms embedded in subforms. I know you're trying to shortcut it by avoiding having to recreate a report. ;)
 
Yep your right, I was just trying to save time. As the forms were changing I thought that if I changed the form it would automatically change the report, so that I wouldn't have to change stuff twice (If that makes sense)

I have created two Sub Reports as you suggested and with a bit of manipulation I can now get the reports to print what I want them to print.

Lesson learnt.

Many Thanks for your help and more importantly your patience.

Thanks again
 

Users who are viewing this thread

Back
Top Bottom