report footer location problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • leemansiuk
    New Member
    • Jun 2006
    • 4

    report footer location problem

    hi all,

    i am quite new to access and have come stuck on quite a simple problem (i think). i have created a report which list items from an orders table etc..

    as the report could grow (listing lots of items from an order), i want only the last page of the report to display a message, i.e. Regards, and a space for a signature, along with a box for a autorised stamp.

    I tried using the report footer and put my message there with signature, etc.. but when the report goes over one page the info i place in the footer is not at the bottom of the last page. sometimes in the middle, sometimes at the top (depending on the size of the order list, pushing the report footer down)

    is there a way to make the report footer stick to the bottom of the page? depending on the size of my order the report could be 1 to say 3 pages long.

    any suggestions would be a great help. :confused:
  • CaptainD
    New Member
    • Mar 2006
    • 135

    #2
    Try putting it in the "Page Footer", not the "Report Footer", should stay at the bottom

    Comment

    • leemansiuk
      New Member
      • Jun 2006
      • 4

      #3
      still got a problem

      Yeah thats right, thanks.

      but that still doesnt fix the problem. as it displays the page footer on every page. whereas i jst want to display my message and stamp box on the last page. which could be the 1st page (if a small number of order items) or many pages (with a large order)

      does that make sense?

      Comment

      • CaptainD
        New Member
        • Mar 2006
        • 135

        #4
        Place this in the "PageHeaderSect ion_Format" (assuming you have 5 sections ReportHeader, PageHeader, Details, PageFooter, ReportFooter)

        Me.Section(4).V isible = (Me.Page = Me.Pages)

        Comment

        • leemansiuk
          New Member
          • Jun 2006
          • 4

          #5
          thanks for that. it worked if the report went over 1 page long. displaying the footer only on the last page.

          but was causing a problem when the report was only one page. i checked the code and it seems right to me. i think there must be a problem / bug with access. with a report of one page in length, the method runs a couple of times with the value of Me.Page and Me.Pages as follows

          1st time
          Me.Page = 1
          Me.Pages = 0

          2nd time
          Me.Page = 1
          Me.Page = 1

          so the footer should be visable, after the 2nd run of the method, but it isnt?

          i got round the problem with the following if statement

          Private Sub PageHeaderSecti on_Format(Cance l As Integer, FormatCount As Integer)
          If (Me.Pages > 0) Then
          Me.Section(4).V isible = (Me.Page = Me.Pages)
          End If
          End Sub

          it now works fine, for one page or many pages,

          thanks again

          Comment

          • Nick67
            New Member
            • Sep 2007
            • 2

            #6
            Hi,

            I have had this problem over and over again--and now that I have it licked, I want to document it.
            <arrg>If your report is very complex me.page = me.pages logic often will fail </arrg>
            What does work, I found on www.tech-archive.net, and the poster there said he found it originally on Accessweb. Thanks all.

            First, you need a group header and footer that can encompass your entire report--something in the underlying query that is the 'one' in a one-to-many relationship. These headers MUST be visible--or their events don't fire--but the controls in them don't need to be visible and their heights can be set to 0.0007"
            In the header, put a textbox named txtFtr, set visible = false and height to 0.0007.

            Next, in the group header's PRINT event add
            Me.txtFtr = True
            in the group footer's PRINT event add
            Me.txtFtr = False
            and finally in the pagefootersecti on's FORMAT event add
            Cancel = Me.txtFTR

            How does it work?
            Because you picked a group that brackets the whole report, the group header is printed right after the report header and page header--and this sets txtFtr to true. The page footer's format is then cancelled on that page and every subsequent page until the group footer is printed at the end of the report (because, again of your choice of group) which sets txtFtr to false and allows the page footer to be printed.

            This worked for me on a report with seven subreports, most of which have noData = true. As a result [page] of [pages] would lie. I would get [pages] = 3--but only 2 pages rendered. As a result, me.page NEVER equals me.pages and the footer would not show!

            Hope this helps those who Google after me!
            Nick67

            Comment

            • Nick67
              New Member
              • Sep 2007
              • 2

              #7
              Hi All,

              Do you ever think with an Access report "close enough, quit messing with it"?
              I do have my report working the way I want--finally.

              The complication was that I wanted to not only stick a bunch of printing at the bottom of the last page of the report, I also wanted pagination, so I wasn't just cancelling a pagefootersecti on_format event. Because page footers DO NOT have CanGrow/CanShrink properties, that meant I was dynamically messing with the page footer size at format time. That was OK until the report crept down far enough that the newly sized footer should have gone onto a new page. Instead, it overlapped with the print above it. What to do...

              I used the 'move group footer' method from kb208979.
              I declared variables in the report's module

              Option Explicit
              Dim FooterMove As Long
              Dim GotLowEnough as boolean
              _______________ _______________ __

              I created the function:

              Private Function SetGrpFtrLoc(Gr pFtrLoc As Double)
              If Me.Top < GrpFtrLoc Then 'Not at location yet, so
              Me.MoveLayout = True 'move to next print location.
              Me.NextRecord = False 'Do not go to next record.
              Me.PrintSection = False 'Do not print the section.
              End If 'Until the required offset is reached

              FooterMove = FooterMove + 1
              End Function
              ______________
              and altered the groupfooter's format and print events
              ______________
              Private Sub GroupFooter1_Fo rmat(Cancel As Integer, FormatCount As Integer)

              Dim GrpFtrLoc As Double
              GrpFtrLoc = (11 - 0.325 - 0.325 - 0.1667 - 1.125 - 0.25) * 1440
              'top of my page footer , paper length minus margins and control heights

              'we'll get here when the function call forces a re-format
              If gotlowenough = True Then
              Me.GroupFooter1 .ForceNewPage = 2 'force a new page
              End If

              If Me.Top > GrpFtrLoc And FooterMove = 0 Then 'we are overprinting already
              gotlowenough = True
              End If
              Call SetGrpFtrLoc(Gr pFtrLoc)

              End Sub
              ______________
              Private Sub GroupFooter1_Pr int(Cancel As Integer, PrintCount As Integer)
              If Me.GroupFooter5 .ForceNewPage = 2 Then
              Me.txtFTR = True
              Else
              Me.txtFTR = False
              End If
              End Sub
              _____________
              I was also forced to create another 'overall' grouping of a 'one' in the one-to-many relationship, because you CAN"T force a new page to print just a PageFooter. The new groupfooter is lower than the original, and has a line control in it and again, a height of just 0.0007." Note that if this footer is not visible, or has no control in it, no events will fire for it. Jus in case you try this and think to completely hide that unneeded stuff :) It also has this code:

              Private Sub GroupFooter2_Pr int(Cancel As Integer, PrintCount As Integer)
              Me.txtFTR = False
              End Sub

              Page of Pages was again occasionally incorrect, so I settled for just Page. The end result is a report that has a page number on every page, and has 1.125" high subreport with some required stuff stuck to the bottom of the last page, and that doesn't mangle itself if the sections above come down into the area needed by that longer page footer.

              Nick67

              Comment

              Working...