Refering to SubReport HasData

  • Thread starter Thread starter Derek Brown
  • Start date Start date
D

Derek Brown

Hi all

am using:
If MySubReport.Report.HasData Then
ReportHeaderTectBox.Visible = False
ReportHeader0.Height = 0
End If
To refer to the subforms HasData property. But I am getting real strange
responce. All I am trying to do is make "ReportHeader" go away when sub has
data and visible again when not.

Is this correct format and if so what else could be wrong?

Thank you
 
Strange Response? What do you mean by that.

Trouble shooting suggestion. Try leaving ReportHeader0.Height = 0 out of
the code and see what happens.
Also, I would expect that you want to set the controls visibility to True if
HasData is False and False if HasData is True. You could use something like
the following to do that.

ReportHeaderTectBox.Visible = Not(MySubReport.Report.HasData )

Where are you executing this code snippet?
 
Is it the Report Header of the main Report or the Report Header of the
Report embedded in the Subreport Control that you want to make invisible? If
the latter, you need to qualify the reference. I am not certain what you are
trying to do by setting the Height to 0. If you could clarify what you are
trying to accomplish rather than showing the way you thought you were going
to implement it, someone might have a useful suggestion.

Larry Linson
Microsoft Access MVP
 
Hi John

The reason for the reverse of the obvious is as follows:
Duane Hookom gave me a brilliant suggestion of how to get a day and date
heading for a diary that lists appointments. But in true diary fassion you
want a report that shows days where no appointments exist, if only so you
can book available free days. As you know reports only print available
records. Duane's idea is that you design a report based on a static table
that just has one field with values 1 - 31 that you add to a predifined date
ie beginning of current month and in the detail you drop a report that shows
any appointments on the day calculated from the 1-31 + the start date
report. Works brilliant except that when you try to group the appointments.
If you group the main report heading with the "with first detail" Access
treats the whole subreport as the first detail, which is no problem if only
one appointment for that day exists but when there are 5 for example the
grouping forces the whole group onto the next page leaving large areas of
white space. To group correctly I need to have the heading in the subreport
unless there are no appointments and then I need to show a heading on the
main report. God it's complicated but I will not be happy until it's right.

The code could run from the subreport on NoData or the main report on
Subreport HasData.

If you can solve this I would be most greatfull.
 
Thanks Larry

The report header I am trying to hide is on the main form. When the
subreport has data the heading of the subreport needs to be visible. If
subreport has no data then the heading of the main report needs to be
visible. The reason for the heading of the main report height setting of 0
is to remove the empty space left by the invisible control on the main form.
allowing the subreport to move to the top of the page

On the main form and subform each heading only shows the day and date. The
problem is I need to show one or the other depending on wether the subreport
has or has not got data.
 
Back
Top