Programmatically removing page headers

Paul Chernoff

Registered User.
Local time
, 20:14
Joined
Aug 24, 2018
Messages
25
I have just been given an Access database developed by someone else and need to immediately generate 25,000 letters. OK, I have a few days as other people finish editing the text. The database was developed in Access 2003 and I have opened it in Access 365. I have never worked in Access before, though I have worked in databases my working life. The original programmer is on vacation, I will need his help in cleaning out all of the junk from the database (e.g. here are forms which get revised every year and they never deleted the older versions).

Each letter will be 2 or 3 pages depending on the amount of data for a single company. I don't think I can describe how the people have been printing out this report for 15 years except to say it is labor intensive because the 1st page for each company has to be printed on special stationary. I am trying to remove the need for stationery by having the appropriate graphics print on the first page of each letter.

My problem is how to get the Page Header to not print on page 1 of each letter. This header has two equations on them and these variables are set to 'null' if [Page] is <= 1. However, I need to place a graphic on page one that overlaps with the Page Header. It will be easier if the Page Header is not visible when [Page]=1. Since I am not familiar with Access I am not sure where to look. The entire first page of each letter is the group-number Header so I was hoping to set the page header to not visible when the group_number Header is on the On Print event, but it is not clear to me what to do. And then have the Print Header be set to visible when the Detail prints.
 
A report header only appears once at the beginning of the report, does this help if you were to suppress the page header on Page 1?
 
I think I need to ask a more basic question. When I look at a text box in the Page Header I see =IIf([Page]<=1,Null,[group_number]) as the contents. Is [Page] a standard variable or is it something created by the programmer? Would [Page] automatically get set to 1 under circumstances or would there be code that states a new group is starting to print, then set [Page] to 1? If the latter, where would I find that programming? I am looking at the Events for the Report and I don't see any entries there except for the case where there is no data.

Is there a good introduction for Access you can recommend for a quick introduction to programming in Access. I feel that I don't know the correct terminology when I ask my questions.
 
'Page' is a property of an Access.Report object.

To suppress the page header on page one, you could probably write code like...
Code:
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
    Me.PageHeaderSection.Visible = Me.Page > 1
End Sub

PageHeaderSection is also a property of an Access.Report, and that code handles the Format event that object.

Mark
 
'Page' is a property of an Access.Report object.

To suppress the page header on page one, you could probably write code like...
Code:
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
    Me.PageHeaderSection.Visible = Me.Page > 1
End Sub

PageHeaderSection is also a property of an Access.Report, and that code handles the Format event that object.

Mark

Now we are getting too the basics that I don't understand. The code you have here makes sense to me, even though I don't know VB. What I don't understand is where do I put this code. I assume that I write this code one place and then put it in a property of the Report. But where do I put the code? Which event should I make to call the code?
 
Ah, figured that out. Thanks. I when to Design in the Ribbon, then View Code and then pasted in the code you gave me. That did the trick. Now I have to insert graphics and do some test reports.

Thank you very much.
 

Users who are viewing this thread

Back
Top Bottom