Show page footer only on 1st page of Access report - ms-access

I have an Access report and I'm able to only show the page footer on the 1st page by putting the below code in the OnPrint event for the page footer, but when I print it to PDF it doesn't show the footer at all. I've tried adding the code to the OnFormat event, but that doesn't work either. Any suggestions?
Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)
Me.PageFooterSection.Visible = Me.[Page] = 1
End Sub

In Access 2016 there is a specific solution. I'm not sure about other Access versions. Go to the report properties. under the format properties you will find both Report Header and Report Footer. Both should be set by default to "all pages". Set Report Footer to "Not with Rpt Hdr"
it looks like they didn't update or adjust for their old enum
Note: All other approaches I tried still set aside blank space for the footer even if you couldn't see it. I tried many combination of setting controls and the PageFooterSection to invisible or height 0.
original answer:
Flip the problem around. Show the text if the page is 1. Controls in the footer have access to the [page] object which gives you the page number. For instance, put a textbox in the page footer and set the textbox control source to something like:
=IIf([Page]=1,"Show this only on page 1","")
In my test the footer only showed on the first page in print preview and pdf.

Related

How to remove Page Header White Space in SSRS report for pages 2..x

We are trying to remove the white space taken up by the Page Header on every subsequent page after page 1. We don't have blank pages, just white space taken up by the header. It also doesn't seem to matter whether we send it directly to the printer or export it to a PDF.
On the Report section, we have set ConsumeContainerWhitespace = True.
On the Page Header section, we have PrintOnFirstPage = True
and PrintOnLastPage = False. Too bad there's not a
PrintOnlyOnFirstPage option!
We have two Rectangles on the Page Header section encompassing all of our header fields, and we've tried setting the Hidden property of these
rectangles to be:
IIF(Globals!PageNumber = 1, False,True).
We have several Text Box fields on the Page Header inside both rectangles. We are turning the visibility attribute of these Text Box fields either on/off depending on whether there's data present in the accompanying data field, e.g. =IIF(Len(First(Fields!SpecialOrderId.Value, "PurchPurchaseOrdersDS")) = 0, True, False).
I've tried the suggestion about putting the header code in the body and programmatically hiding it, but I'm getting this error:
\SSRS Reports\Reports\PurchPurchaseOrder : error AX3026: : PageNumber is invalid. InvalidIdentifier
THECODE:
Public Function PageNumber() As String
Return Me.Report.Globals!PageNumber
End Function
CALLING IT:
=IIF(Code.PageNumber() = "1", False,True)
Thanking you in advance.
Folks, I found a link on a webpage that said: "VB code is no more supported in AX2012-SSRS". Obviously this is why the PageNumber() function does not work for us. However, using Harry's suggestion of moving our header fields into the body of the report fixed our issue and we no longer have two inches of blank white space on pages 2..x! Thanks!

hiding and removing white space of header in ssrs report

I'm working on ssrs report,i need to hide the header on last page for that I did visibility changes to the controls inside the header whatever I used.
I used this code
=IIF(Globals!PageNumber = Globals!TotalPages - 1 or Globals!PageNumber = Globals!TotalPages ,true,false)
it's working fine.
but after hiding the header controls the header white space showing on last page. i need to remove the white space occupying by header is there any way to remove that.
You are hiding the controls on that expression so even if the controls are hidden then also the header is there. So that header is still occupying the white space. You can not hide header or remove that whitespace(As far as I know) but there is another approach you can try.
Add your header content on the reports main body and set the visibility expression there.
There is one catch though you can not access the PageNumber directly in the report body for that you need to Create functions in the code under the report properties:
Page Number:
Function PageNumber() As String
Return Me.Report.Globals!PageNumber
End Function
Total Pages:
Function TotalPages() As String
Return Me.Report.Globals!TotalPages
End Function

Hide report page footer

i have developed an access report which is made up of 4 subreports. the first subreport is just a cover page for the report. In the main report footer i have added page numbers. the page numbers are displayed on every page of the report including my cover page. I do not want to display the page number (which is page 1 ) on the cover page. As anyone had a similar problem like this and if so could you help me with my problem, thanks
There's no automatic way to do it. But if you know VBA, you can create a function that does it for you.
You'll want a textbox in your Page Footer section. Use =ShowPage() as the Control Source. Then you'll want this code in a module:
Function ShowPage(Optional ClearPage As Boolean)
Static PageNum As Integer
If ClearPage Then
PageNum = 0
End If
If PageNum > 0 Then
ShowPage = PageNum
End If
PageNum = PageNum + 1
End Function
Lastly, put 'ShowPage True' under the Report_Load event. This will reset the counter each time the report is run.
Try this. Open your report in design view. Double click the small square at the top left corner of your report to open the report property sheet. Click on the "Format" tab and scroll to the bottom. Set your "Page Footer" property to "Not with Report Hdr". The report header is usually the first page of the report. Your first sub report should be positioned in the header section of the main report. Then the page footer will not print on the first page. Hope this helps.

Repeating certain elements on new pages in SSRS

I'm pretty new with SSRS and I'm looking for a way to implement the following. I'm having a table that is expected to be rendered in multiple pages and I need to repeat an element in the report with every new page as in the shown image.
For example, if the table takes more than one page, what I need to do is to repeat the image in red and hide the image in green in the new pages.
I tried creating a subreport and adding those element to the headers but that didn't work. Obviously, the subreports headers and footers aren't rendered in the master report.
No need for subreport. Add a page header to your report (Report menu -> Add Page Header), and move the red box into the page header. In the body of the report put the green box, and then tablix/table. It should look similar to this in the design view:
In my case, I added a variable then insert code in Report Properties:
Public Function IsFirstPage(resident as string, currentResident as Microsoft.ReportingServices.ReportProcessing.OnDemandReportObjectModel.Variable) as Boolean
If (resident<>currentResident.Value) Then
currentResident.Value = resident
Return True
Else
Return False
End If
End Function
Then add Expression to Hidden element (your case is the image in green):
=IIf(Code.IsFirstPage(Fields!szFirstName.Value+Fields!szLastName.Value, Variables!currentResident), False, True)

Force SSRS 2005 to print a new page

I have a field on the footer that may contain more text the the textbox would support. If it does, I need the report to print another page, even if it's completely empty, containing only the footer field.
Basically, if a condition is true, I want the report to print a new page, displaying my footer in it, even if there's nothing else to be printed.
How can I achieve this, preferably with field expressions?
And if you have a solution that's not a field expression (external code for example), could you also point me to the basics of it?
On any block you have the property PageBreak, you can choose begin, end or none. By choosing end, a page break will be insered after the block.
=iif(Globals!PageNumber Mod 2,True,False) this helped me to show (visibility) a text box on even pages only from my footer