Header Section Lables for Subreport Data (?)

C

croy

If I put the labels for my subreport in the subreport with
the data, and the data spills over to a second page, I don't
get the labels at the top of the columns on the second page
of data.

If I move the labels to the main report header section, the
labels print each entry in the main report, whether or not
there is data in the subreport.

I'd like the headers to only be visible when there is data
in the subreport, and to always appear at the top of the
subreport data that spill over onto a second page. Is this
possible?
 
L

Larry Linson

You could put the Labels on the parent report, and check in the OnCurrent
event of the parent report's record to determine if any records are
displayed in the report in the Subreport Control, then set the Visible
property of the Labels.

You can either use a domain aggregate funtion (DFirst, DLookup, or DCount --
see Help) or you could check a field which always has a value if the record
is present (such as an ID field).

Larry Linson
Microsoft Office Access MVP
 
C

croy

croy said:
You could put the Labels on the parent report, and check in the OnCurrent
event of the parent report's record to determine if any records are
displayed in the report in the Subreport Control, then set the Visible
property of the Labels.

You can either use a domain aggregate funtion (DFirst, DLookup, or DCount --
see Help) or you could check a field which always has a value if the record
is present (such as an ID field).


Just a novice here, having another thought....

Would this be a good situation to use the "On no data" event
of the subreport?
 
C

croy

Oops! Now I see (by reading the help file more closely,
using the "On no data" event won't work.
 
C

croy

croy said:
You could put the Labels on the parent report, and check in the OnCurrent
event of the parent report's record to determine if any records are
displayed in the report in the Subreport Control, then set the Visible
property of the Labels.

You can either use a domain aggregate funtion (DFirst, DLookup, or DCount --
see Help) or you could check a field which always has a value if the record
is present (such as an ID field).

Larry Linson
Microsoft Office Access MVP

Thanks for your reply.

I tried the following in the Current event of the main
report (I changed from labels to Text boxes so that I could
use the "Can Shrink" property on them):

If IsNull(Me![rptAccessCheckSubDetailObject]. _
Report![txtIvDetId]) Then
Me![txtIvTime].Visible = True
[...]

.... but keep getting the 2455 error, and don't know how to
find out why (it points to the "If" line). All the field
and report names *seem* to be correct.


For now, I have this in the Format event of the Section on
the main report:

Me![txtIvTime].Visible = _
Me![rptAccessCheckSubDetailObject].Report.HasData
Me![txtFishMethod].Visible = _
Me![rptAccessCheckSubDetailObject].Report.HasData
[yada, yada, yada]

.... and it seems to be working. But it does seem to me that
it might be more on the mark if I could get it to work your
way.
 

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