Change Textbox Text in PageHeader Depending on Section being Processed

  • Thread starter Thread starter Wayfarer
  • Start date Start date
W

Wayfarer

I am at my wit's end. It wasn't a long trip, but I'm definitely there.

I have been trying to develop a report that has a textbox that shows a
different message depending on what section of the report is being
processed (e.g.-for groupfooter1, which contains a subreport, it should
show "Monthly Totals", for the report footer, another subreport, it
should show "Overall Totals").

In the report's module I set up a module-wide variable that is
*supposed* to indicate which report section is being processed and a
function to retrieve the variable, which is supposed to controlwhat it
displayed via an IIf in the PageHeader textbox.

I have tried the Format AND Print events for both the ReportFooter and
Header and the GroupFooter1 and Header1, and I can get the textbox to
change, but just not in the when I want it too. I think I'm missing
something about how these events fire.

I'm using Access 2000 on an XP box.
Is there any helpfor me or is it too late?

TIA

Neill
 
I would think you would want to share your code. Also, why would you want to
do this rather than "hard-coding" the value or sticking it in your report's
record source.
 
Thank you for your response. I don't understand what you mean by
hard-coding in this case. How would I hard-code text to appear in the
PageHeader that is different for certain grouped sections? Perhaps you
mean separate texboxes with toggled visibility depending on the section
being processed? I tried that, and the same problem of having the
proper text appear depending on the section is exactly the same as the
method I've chosen (but messier, IMO). Please let me know if I've
misunderstood you. I've been working on this report for about 2 weeks
and I'm ready to bludgeon the next person who asks me, "Is it finished
yet?" Perhaps a bit Scroogish...

The following is the IIf statement from the textbox in the
PageHeaderSection:

=IIf(getwhere()=0,[program],IIf(getwhere()=1,"Monthly Totals","Overall
Totals"))

The following is the code from the report module. There are two groups
1) Date and 2) Program:

ReportHeader (contains nothng)
PageHeaderSection (has the textbox with the text I want to change
depending on section being processed)
DateHeader
ProgramHeader
Detail
ProgramFooter
DateFooter (contains a subreport that shows totals for a month)
PageFooterSection (contains nothing)
ReportFooter (contains a subreport that shows totals for the entire
reporting period)

begin code ===========

Option Compare Database
Option Explicit

Private iWhere

Private Sub DateFooter_Print(Cancel As Integer, PrintCount As Integer)
iWhere = 1
End Sub

Private Sub Report_Open(Cancel As Integer)
iWhere = 0
End Sub

Private Function GetWhere()
GetWhere = iWhere
End Function

Private Sub ReportFooter_Print(Cancel As Integer, PrintCount As
Integer)
iWhere = 2
End Sub

end code ===========
Anyway, I appreciate any help I can get.

Neill Dumont
 
You should be able to determine if the page is the last by using check for
[Page] = [Pages].
Have you looked at the Repeat Section property of the Date Header and/or
Program Header?
 
Back
Top