How to make a no data subreport dissappear

D

DOYLE60

I have a subreport in a group header in a report. It is the only thing in that
section. Some of the records in the detail match it and it prints out the
related data. But when there is no related data, it still prints a big fat
blank. I don't want that big fat blank. I usually solve this with a running
sum count. But this time that won't do.

How do I solve this?

Thanks,

Matt
 
L

losmac

All reports have property: OnNoRecords (or something like
that, I use different language). Try to use it!
 
D

DOYLE60

I saw that but didn't know how to use it. I wrote some code that didn't give
an error but didn't work as well. I believe it only works if there is no data
at all in the subreport. In my case, there is data for some records in the
main report and no data for others.

Also, how do I manage getting rid of the space I created for the subreport on
the main report? So I have to say if there is no data in the sub, then this
section should be not visible.

I do this sort of thing when running sums are 0. But not in cases like this.

Matt
 
T

tina

try this

in the main report design view: set the group header
section's CanGrow and CanShrink properties to Yes. set the
subreport control's CanGrow and CanShrink properties to
Yes.

hth
 
D

DOYLE60

try this
in the main report design view: set the group header
section's CanGrow and CanShrink properties to Yes. set the
subreport control's CanGrow and CanShrink properties to
Yes.
hth

This does not work. There is still a blank space still. And it is truly a
blank space because all the lines and shading, as well as the labels, are
missing when there is no data. I need to get some data into the main report
from the sub report, some total or line count, and use that data to tell Access
not to print that section. I can't seem to get that data into the main report.

I have no idea how to use the OnNoData property. I tried but don't know.

Matt
 
T

tina

hmmm, i tested that solution before posting it and it
worked for me, so i don't know what else to suggest. if
you'd like to send me a copy of your db, i'll see if i can
get it to work and send it back so you can see how i did
it. compact your db, zip it (pls, my downloads run slow)
and email to me at ttaccess1.REMOVEincludingLEADINGdot at
yahoo dot com

try this
in the main report design view: set the group header
section's CanGrow and CanShrink properties to Yes. set the
subreport control's CanGrow and CanShrink properties to
Yes.
hth

This does not work. There is still a blank space still.
And it is truly a
blank space because all the lines and shading, as well as
the labels, are
missing when there is no data. I need to get some data
into the main report
from the sub report, some total or line count, and use
that data to tell Access
not to print that section. I can't seem to get that data
into the main report.

I have no idea how to use the OnNoData property. I tried
but don't know.

Matt
 
D

DOYLE60

Thanks. I got it. I had to take the vertical lines out that I put in the main
form but under the subform control. I now put these in the subform itself. (I
put them in the wrong place for appearance purposes after failing to rid the
report of the unwanted blank space we now got rid of.)

But it doesn't shrink itself. I have to make the subreport control zero in
height and shrink the group header to .0042. From this, it will grow, however.

So solved. Thanks again,

Matt
 
M

Marshall Barton

DOYLE60 said:
Thanks. I got it. I had to take the vertical lines out that I put in the main
form but under the subform control. I now put these in the subform itself. (I
put them in the wrong place for appearance purposes after failing to rid the
report of the unwanted blank space we now got rid of.)

But it doesn't shrink itself. I have to make the subreport control zero in
height and shrink the group header to .0042. From this, it will grow, however.


Another way is to check the subreport's HasData property and
either make the header invisible or cancel the header
section's format event:

Me.Section(5??).Visible = Me.subreport.Report.Has Data
or
Cancel = Not Me.subreport.Report.Has Data
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top