access 2002 report header

F

fhsmith7

I use Access 2002. I have a report that I want the report header to
repeat on all pages of the report
using code. For example, first page report header is Main Report. All
subsequant pages would read Main Report Continued.

How do I code this to make it happen?

Looking forward to any responses. Thanks tons in advance for your
assistance.
 
A

Access Developer

Why ask for a Report Header (which by definition, appears at the beginning
of the Report only) to repeat? Why not use a Page Header (which by
definition, repeats)? VBA code in the Format or Print event of the page
header can make Text Boxes visible / invisible, based on page number, to
accomplish your need for "continued"; another way I have done something
similar is to put the "continued" in a separate Text Box and manipulate its
Visible property with VBA code.
 
F

fhsmith7

Why ask for a Report Header (which by definition, appears at the beginning
of the Report only) to repeat? Why not use a Page Header (which by
definition, repeats)?  VBA code in the Format or Print event of the page
header can make Text Boxes visible / invisible, based on page number, to
accomplish your need for "continued"; another way I have done something
similar is to put the "continued" in a separate Text Box and manipulate its
Visible property with VBA code.

--
Larry Linson
  Microsoft Office Access MVP
  Co-Author, Microsoft Access Small Business Solutions, Wiley 2010








- Show quoted text -

Thanks Larry for comments. Since I am new to code, how would you write
the code for invisible?
 
A

Access Developer

If you put the continuation text in a Label Control named lblContinuation,
then the following VBA in the Format Event should do what you want:

If Page = 1 Then
Me.lblContinuation.Visible = False
Else
Me.lblContinuation.Visible = True
End If

You'll need to add your own error handling code, if you want it.

The code above is copied with minor changes from a sample report
(illustrating being able to hide a column or columns, remove the headers,
and move the remaining columns and their headers left... I probably created
that to assist in answering a question in one of these newsgroups... it's
not functionality that I recall in any production database application I
worked on) that I created several years ago, that is, the name of the label
control, and omission of some other codeand works for me.

--
Larry Linson
Microsoft Office Access MVP
Co-Author, Microsoft Access Small Business Solutions, Wiley 2010

Why ask for a Report Header (which by definition, appears at the beginning
of the Report only) to repeat? Why not use a Page Header (which by
definition, repeats)? VBA code in the Format or Print event of the page
header can make Text Boxes visible / invisible, based on page number, to
accomplish your need for "continued"; another way I have done something
similar is to put the "continued" in a separate Text Box and manipulate
its
Visible property with VBA code.

--
Larry Linson
Microsoft Office Access MVP
Co-Author, Microsoft Access Small Business Solutions, Wiley 2010








- Show quoted text -

Thanks Larry for comments. Since I am new to code, how would you write
the code for invisible?
 
F

fhsmith

If you put the continuation text in a Label Control named lblContinuation,
then the following VBA in the Format Event should do what you want:

 If Page = 1 Then
    Me.lblContinuation.Visible = False
 Else
    Me.lblContinuation.Visible = True
 End If

You'll need to add your own error handling code, if you want it.

The code above is copied with minor changes from a sample report
(illustrating being able to hide a column or columns, remove the headers,
and move the remaining columns and their headers left... I probably created
that to assist in answering a question in one of these newsgroups... it's
not functionality that I recall in any production database application I
worked on) that I created several years ago, that is, the name of the label
control, and omission of some other codeand works for me.
Thanks Larry for comments. Since I am new to code, how would you write
the code for invisible?


Thanks tons Larry. Tried your suggestions and everything works
perfectly.
 
A

Access Developer

You're most welcome and I'm glad it accomplished what you wanted -- I
participate here so I can be of help.

It can seem almost unbelieveable what you can make Access do with an
understanding of how Access works and how to apply a little VBA...

--
Larry Linson
Microsoft Office Access MVP
Co-Author, Microsoft Access Small Business Solutions, Wiley 2010

If you put the continuation text in a Label Control named lblContinuation,
then the following VBA in the Format Event should do what you want:

If Page = 1 Then
Me.lblContinuation.Visible = False
Else
Me.lblContinuation.Visible = True
End If

You'll need to add your own error handling code, if you want it.

The code above is copied with minor changes from a sample report
(illustrating being able to hide a column or columns, remove the headers,
and move the remaining columns and their headers left... I probably
created
that to assist in answering a question in one of these newsgroups... it's
not functionality that I recall in any production database application I
worked on) that I created several years ago, that is, the name of the
label
control, and omission of some other codeand works for me.
Thanks Larry for comments. Since I am new to code, how would you write
the code for invisible?


Thanks tons Larry. Tried your suggestions and everything works
perfectly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top