Headers And Footers

WayneRyan

AWF VIP
Local time
Today, 22:10
Joined
Nov 19, 2002
Messages
7,122
Hi all,

I solved this problem in A97 in a very ugly way. It seems that
life will be a bit better in A2000.

The following is an investigation in the way that the Access 2000
Report Writer thinks. The report contains info about S/W test
procedures; Paragraph, Procedure, Expected Result, Pass/Fail.
Assume that the Pass/Fail = (A, B, C) (A - best, C - Worst).

The Page Header and Footer should have the maximum grade that
is found on the page.

This can't be done with a query because there are a variable
number of records that may appear on a page (sometimes only 1).

So that leaves code ...

The first phase, as Access formats the report will be data
collection into Grades(NumberOfPages).

The second phase, the Header Format event will be used to
populate the header/footer.

If anyone knows of a better approach, I'd be glad to hear it.

Public Phase1 As Boolean
Public Grade(1000) As String

Code:
Event                Page Line Item ("Sorted" Paragraph #)  Event Code
==================== ==== ================================  ====================================================
Report Open            0                                    Phase1 = True

  Page Header Format   1  003.009.004.015.001.001           If Phase1 = True Then
                                                               Grade(Me.Report.Page) = "" 
                                                            Else
                                                               ' Actually Grade(Me.Report.Page) is like "BBCACA"
                                                               ' But that's easily handled 
                                                               Me.HeaderField = Grade(Me.Report.Page)
                                                               Me.FooterField = Grade(Me.Report.Page)
                                                            End if
    Detail Format      1  003.009.004.015.001.001           If Phase1 = True Then
                                                               Grade(Me.Report.Page) = Grade(Me.Report.Page) & Me.PassFail 
                                                            Else
                                                               ' Do Nothing
                                                            End if
    Detail Format      1  003.009.004.015.002
    Detail Format      1  003.009.004.015.003
    Detail Format      1  003.009.004.015.004
    Detail Format      1  003.009.004.015.005
    Detail Format      1  003.009.004.015.006
    Detail Format      1  003.009.004.015.007
    Detail Format      1  003.009.004.015.008
    Detail Format      1  003.009.004.015.009
    Detail Format      1  003.009.004.015.010  <-- Won't fit on page
  Page Footer Format   1  003.009.004.015.009             If Phase1 = True Then
                                                             ' It always formats one too many ...
                                                             Grade(Page) = Mid(Grade(Page), 1, Len(Grade(Page)) - 1)
                                                          Else
                                                             ' Do Nothing
                                                          End if
  Page Header Format   2  003.009.004.015.010
    Detail Format      2  003.009.004.015.010
    Detail Format      2  003.009.004.015.011
    Detail Format      2  003.009.004.015.012
    Detail Format      2  003.009.004.015.013
  Page Footer Format   2  003.009.004.015.012  

  Page Header Format   3  003.009.004.015.013
    Detail Format      3  003.009.004.015.013
    Detail Format      3  003.009.004.015.014
    Detail Format      3  003.009.004.015.015
    Detail Format      3  003.009.004.015.016
    Detail Format      3  003.009.004.015.017
    Detail Format      3  003.009.004.015.018
    Detail Format      3  003.009.004.015.019
    Detail Format      3  003.009.004.015.020  
  Page Footer Format   3  003.009.004.015.019

  Page Header Format   4  003.009.004.015.020
    Detail Format      4  003.009.004.015.020
    Detail Format      4  003.009.004.015.021
    Detail Format      4  003.009.004.015.022
    Detail Format      4  003.009.004.015.023
    Detail Format      4  003.009.004.015.024  
  Page Footer Format   4  003.009.004.015.023

  Page Header Format   5  003.009.004.015.024
    Detail Format      5  003.009.004.015.024
    Detail Format      5  003.009.004.015.025
    Detail Format      5  003.009.004.015.026
    Detail Format      5  003.009.004.015.027
    Detail Format      5  003.009.004.015.028  
  Page Footer Format   5  003.009.004.015.027

  Page Header Format   6  003.009.004.015.028
    Detail Format      6  003.009.004.015.028
    Detail Format      6  003.009.004.015.029
    Detail Format      6  003.009.004.015.030
    Detail Format      6  003.009.004.015.031  
 Report Footer Format  6  003.009.004.015.031            Phase2 = True 
  Page Footer Format   6  003.009.004.015.031 

  Page Header Format   1  003.009.004.015.001.001 <-- In Phase two, all logic is defined in the HeaderFormat Event above
  Page Header Print    1  003.009.004.015.001.001
    Detail Format      1  003.009.004.015.001.001
    Detail Print       1  003.009.004.015.001.001
    Detail Format      1  003.009.004.015.002
    Detail Print       1  003.009.004.015.002
    Detail Format      1  003.009.004.015.003
    Detail Print       1  003.009.004.015.003
    Detail Format      1  003.009.004.015.004
    Detail Print       1  003.009.004.015.004
    Detail Format      1  003.009.004.015.005
    Detail Print       1  003.009.004.015.005
    Detail Format      1  003.009.004.015.006
    Detail Print       1  003.009.004.015.006
    Detail Format      1  003.009.004.015.007
    Detail Print       1  003.009.004.015.007
    Detail Format      1  003.009.004.015.008
    Detail Print       1  003.009.004.015.008
    Detail Format      1  003.009.004.015.009
    Detail Print       1  003.009.004.015.009
    Detail Format      1  003.009.004.015.010
  Page Footer Format   1  003.009.004.015.009
  Page Footer Print    1  003.009.004.015.009


 Note:  Removed next few pages to keep the size down


  Page Header Format   6  003.009.004.015.028
  Page Header Print    6  003.009.004.015.028
    Detail Format      6  003.009.004.015.028
    Detail Print       6  003.009.004.015.028
    Detail Format      6  003.009.004.015.029
    Detail Print       6  003.009.004.015.029
    Detail Format      6  003.009.004.015.030
    Detail Print       6  003.009.004.015.030
    Detail Format      6  003.009.004.015.031
    Detail Print       6  003.009.004.015.031
 Report Footer Format  6  003.009.004.015.031
  Page Footer Format   6  003.009.004.015.031
  Page Footer Print    6  003.009.004.015.031
Report Close           6  003.009.004.015.031

Thanks,
Wayne
 

Users who are viewing this thread

Back
Top Bottom