PC Review


Reply
Thread Tools Rate Thread

Controls on Page Header

 
 
=?Utf-8?B?RGV2ZWxvcGVyIG9mIHRoZSBDYXJpYmJlYW4=?=
Guest
Posts: n/a
 
      14th Apr 2006
On an Access Report, I would like two controls to be visible on the page
header section only if they appear on the first page.

While the If clause in the following statement is not triggered on the first
page, it is triggered on subsequent pages, but the control is rendered
invisible on all pages.

Any ideas how I can get the control to remain visible on only the first page?

- - - - - - - -

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)

If Me.Page <> 1 Then
With Me.ControlName
.Visible = False
.Top = 0
.Left = 0
.Height = 0
.Width = 0
End with
End If
 
Reply With Quote
 
 
 
 
fredg
Guest
Posts: n/a
 
      14th Apr 2006
On Thu, 13 Apr 2006 16:07:02 -0700, Developer of the Caribbean wrote:

> On an Access Report, I would like two controls to be visible on the page
> header section only if they appear on the first page.
>
> While the If clause in the following statement is not triggered on the first
> page, it is triggered on subsequent pages, but the control is rendered
> invisible on all pages.
>
> Any ideas how I can get the control to remain visible on only the first page?
>
> - - - - - - - -
>
> Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
> Integer)
>
> If Me.Page <> 1 Then
> With Me.ControlName
> .Visible = False
> .Top = 0
> .Left = 0
> .Height = 0
> .Width = 0
> End with
> End If


In the Page Header Format event:
Me![ControlName].Visible = Me.[Page] = 1

Why were you attempting to set the other properties to 0 if the
control is not going to be visible anyway?
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 
Reply With Quote
 
Marshall Barton
Guest
Posts: n/a
 
      14th Apr 2006
Developer of the Caribbean wrote:

>On an Access Report, I would like two controls to be visible on the page
>header section only if they appear on the first page.
>
>While the If clause in the following statement is not triggered on the first
>page, it is triggered on subsequent pages, but the control is rendered
>invisible on all pages.
>
>Any ideas how I can get the control to remain visible on only the first page?
>
>- - - - - - - -
>
>Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
>Integer)
>
>If Me.Page <> 1 Then
> With Me.ControlName
> .Visible = False
> .Top = 0
> .Left = 0
> .Height = 0
> .Width = 0
> End with
>End If



You should set the properties appropriately for page 1 too.
There are situations (e.g. you used Pages in a text box)
when a report must be processed twicw and your setting for
the last page is still in effect the second time the first
page is formatted.

Note that you do not need to set the position properties.
Making it invisible is sufficient. I'm pretty sure all you
need is this one line:

Me.ControlName.Visible = (Me.Page = 1)

--
Marsh
MVP [MS Access]
 
Reply With Quote
 
=?Utf-8?B?RGV2ZWxvcGVyIG9mIHRoZSBDYXJpYmJlYW4=?=
Guest
Posts: n/a
 
      14th Apr 2006
Thanks Fredg!

That works. Do you know why your code works, but mine did not? (Mine made
the control invisible on all pages, even though it evaluated properly for
page 1.)

I changed the other properties of the control (Top, Left, Height, Width) so
that the section would resize properly (I also changed the
Me.PageHeaderSection.Height property to resize the Header height.)

Is that the problem? Can the PageHeaderSection.Height property be different
on each page, or does it have to be the same for all pages? Perhaps the
control was visible, but the PageHeaderSection.Height was too low, so it did
not show up.

Thanks again!

"fredg" wrote:

> On Thu, 13 Apr 2006 16:07:02 -0700, Developer of the Caribbean wrote:
>
> > On an Access Report, I would like two controls to be visible on the page
> > header section only if they appear on the first page.
> >
> > While the If clause in the following statement is not triggered on the first
> > page, it is triggered on subsequent pages, but the control is rendered
> > invisible on all pages.
> >
> > Any ideas how I can get the control to remain visible on only the first page?
> >
> > - - - - - - - -
> >
> > Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
> > Integer)
> >
> > If Me.Page <> 1 Then
> > With Me.ControlName
> > .Visible = False
> > .Top = 0
> > .Left = 0
> > .Height = 0
> > .Width = 0
> > End with
> > End If

>
> In the Page Header Format event:
> Me![ControlName].Visible = Me.[Page] = 1
>
> Why were you attempting to set the other properties to 0 if the
> control is not going to be visible anyway?
> --
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail
>

 
Reply With Quote
 
=?Utf-8?B?RGV2ZWxvcGVyIG9mIHRoZSBDYXJpYmJlYW4=?=
Guest
Posts: n/a
 
      14th Apr 2006
Thanks Marshall!

Any thoughts on my above reply to fredg? Is the real problem here that I
set Me.PageHeaderSection.Height? Does that properly have to be the same for
all pages?

"Marshall Barton" wrote:

> Developer of the Caribbean wrote:
>
> >On an Access Report, I would like two controls to be visible on the page
> >header section only if they appear on the first page.
> >
> >While the If clause in the following statement is not triggered on the first
> >page, it is triggered on subsequent pages, but the control is rendered
> >invisible on all pages.
> >
> >Any ideas how I can get the control to remain visible on only the first page?
> >
> >- - - - - - - -
> >
> >Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
> >Integer)
> >
> >If Me.Page <> 1 Then
> > With Me.ControlName
> > .Visible = False
> > .Top = 0
> > .Left = 0
> > .Height = 0
> > .Width = 0
> > End with
> >End If

>
>
> You should set the properties appropriately for page 1 too.
> There are situations (e.g. you used Pages in a text box)
> when a report must be processed twicw and your setting for
> the last page is still in effect the second time the first
> page is formatted.
>
> Note that you do not need to set the position properties.
> Making it invisible is sufficient. I'm pretty sure all you
> need is this one line:
>
> Me.ControlName.Visible = (Me.Page = 1)
>
> --
> Marsh
> MVP [MS Access]
>

 
Reply With Quote
 
John Spencer
Guest
Posts: n/a
 
      14th Apr 2006
How about you set the control's visibility to false in the format event and
by the time you got to the print event the control was no longer visible.


"Developer of the Caribbean"
<(E-Mail Removed)> wrote in message
news:4BD4300B-5F6D-46B6-A301-(E-Mail Removed)...
> Thanks Marshall!
>
> Any thoughts on my above reply to fredg? Is the real problem here that I
> set Me.PageHeaderSection.Height? Does that properly have to be the same
> for
> all pages?
>
> "Marshall Barton" wrote:
>
>> Developer of the Caribbean wrote:
>>
>> >On an Access Report, I would like two controls to be visible on the page
>> >header section only if they appear on the first page.
>> >
>> >While the If clause in the following statement is not triggered on the
>> >first
>> >page, it is triggered on subsequent pages, but the control is rendered
>> >invisible on all pages.
>> >
>> >Any ideas how I can get the control to remain visible on only the first
>> >page?
>> >
>> >- - - - - - - -
>> >
>> >Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
>> >Integer)
>> >
>> >If Me.Page <> 1 Then
>> > With Me.ControlName
>> > .Visible = False
>> > .Top = 0
>> > .Left = 0
>> > .Height = 0
>> > .Width = 0
>> > End with
>> >End If

>>
>>
>> You should set the properties appropriately for page 1 too.
>> There are situations (e.g. you used Pages in a text box)
>> when a report must be processed twicw and your setting for
>> the last page is still in effect the second time the first
>> page is formatted.
>>
>> Note that you do not need to set the position properties.
>> Making it invisible is sufficient. I'm pretty sure all you
>> need is this one line:
>>
>> Me.ControlName.Visible = (Me.Page = 1)
>>
>> --
>> Marsh
>> MVP [MS Access]
>>



 
Reply With Quote
 
Marshall Barton
Guest
Posts: n/a
 
      15th Apr 2006
Changing the height of the control is fine if you really
needed to do that, but in this case its just a waste of time
and you would have to add more code to set it back to its
original position and size in the report header's Format
event.

As I said before, the use of Pages in a text box is the
common reason why your code didn't appear to work. The
reason our code did work is strictly because it makes the
control visible when needed (and invisible otherwise).
--
Marsh
MVP [MS Access]


Developer of the Caribbean wrote:
>Any thoughts on my above reply to fredg? Is the real problem here that I
>set Me.PageHeaderSection.Height? Does that properly have to be the same for
>all pages?
>
>
>> Developer of the Caribbean wrote:
>> >On an Access Report, I would like two controls to be visible on the page
>> >header section only if they appear on the first page.
>> >
>> >While the If clause in the following statement is not triggered on the first
>> >page, it is triggered on subsequent pages, but the control is rendered
>> >invisible on all pages.
>> >
>> >Any ideas how I can get the control to remain visible on only the first page?
>> >
>> >- - - - - - - -
>> >
>> >Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
>> >Integer)
>> >
>> >If Me.Page <> 1 Then
>> > With Me.ControlName
>> > .Visible = False
>> > .Top = 0
>> > .Left = 0
>> > .Height = 0
>> > .Width = 0
>> > End with
>> >End If

>>
>>

>"Marshall Barton" wrote:
>> You should set the properties appropriately for page 1 too.
>> There are situations (e.g. you used Pages in a text box)
>> when a report must be processed twicw and your setting for
>> the last page is still in effect the second time the first
>> page is formatted.
>>
>> Note that you do not need to set the position properties.
>> Making it invisible is sufficient. I'm pretty sure all you
>> need is this one line:
>>
>> Me.ControlName.Visible = (Me.Page = 1)

 
Reply With Quote
 
=?Utf-8?B?RGV2ZWxvcGVyIG9mIHRoZSBDYXJpYmJlYW4=?=
Guest
Posts: n/a
 
      17th Apr 2006
Thanks Marshall. I think I've got it now.

"Marshall Barton" wrote:

> Changing the height of the control is fine if you really
> needed to do that, but in this case its just a waste of time
> and you would have to add more code to set it back to its
> original position and size in the report header's Format
> event.
>
> As I said before, the use of Pages in a text box is the
> common reason why your code didn't appear to work. The
> reason our code did work is strictly because it makes the
> control visible when needed (and invisible otherwise).
> --
> Marsh
> MVP [MS Access]
>
>
> Developer of the Caribbean wrote:
> >Any thoughts on my above reply to fredg? Is the real problem here that I
> >set Me.PageHeaderSection.Height? Does that properly have to be the same for
> >all pages?
> >
> >
> >> Developer of the Caribbean wrote:
> >> >On an Access Report, I would like two controls to be visible on the page
> >> >header section only if they appear on the first page.
> >> >
> >> >While the If clause in the following statement is not triggered on the first
> >> >page, it is triggered on subsequent pages, but the control is rendered
> >> >invisible on all pages.
> >> >
> >> >Any ideas how I can get the control to remain visible on only the first page?
> >> >
> >> >- - - - - - - -
> >> >
> >> >Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
> >> >Integer)
> >> >
> >> >If Me.Page <> 1 Then
> >> > With Me.ControlName
> >> > .Visible = False
> >> > .Top = 0
> >> > .Left = 0
> >> > .Height = 0
> >> > .Width = 0
> >> > End with
> >> >End If
> >>
> >>

> >"Marshall Barton" wrote:
> >> You should set the properties appropriately for page 1 too.
> >> There are situations (e.g. you used Pages in a text box)
> >> when a report must be processed twicw and your setting for
> >> the last page is still in effect the second time the first
> >> page is formatted.
> >>
> >> Note that you do not need to set the position properties.
> >> Making it invisible is sufficient. I'm pretty sure all you
> >> need is this one line:
> >>
> >> Me.ControlName.Visible = (Me.Page = 1)

>

 
Reply With Quote
 
slickdock
Guest
Posts: n/a
 
      14th Apr 2009
Similar problem. How can I make the entire Page Header invisible on page 1
and visible >Page 1? Rather than code each control separately, I'd like to
code the entire header.

"Marshall Barton" wrote:

> Developer of the Caribbean wrote:
>
> >On an Access Report, I would like two controls to be visible on the page
> >header section only if they appear on the first page.
> >
> >While the If clause in the following statement is not triggered on the first
> >page, it is triggered on subsequent pages, but the control is rendered
> >invisible on all pages.
> >
> >Any ideas how I can get the control to remain visible on only the first page?
> >
> >- - - - - - - -
> >
> >Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
> >Integer)
> >
> >If Me.Page <> 1 Then
> > With Me.ControlName
> > .Visible = False
> > .Top = 0
> > .Left = 0
> > .Height = 0
> > .Width = 0
> > End with
> >End If

>
>
> You should set the properties appropriately for page 1 too.
> There are situations (e.g. you used Pages in a text box)
> when a report must be processed twicw and your setting for
> the last page is still in effect the second time the first
> page is formatted.
>
> Note that you do not need to set the position properties.
> Making it invisible is sufficient. I'm pretty sure all you
> need is this one line:
>
> Me.ControlName.Visible = (Me.Page = 1)
>
> --
> Marsh
> MVP [MS Access]
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      15th Apr 2009
"slickdock" <(E-Mail Removed)> wrote in message
newsADB8717-E248-479E-A7F9-(E-Mail Removed)...
> Similar problem. How can I make the entire Page Header invisible on page 1
> and visible >Page 1? Rather than code each control separately, I'd like to
> code the entire header.



Have you tried code like this in the Format event of the PageHeader section?

'----- start of code -----
Private Sub PageHeaderSection_Format( _
Cancel As Integer, _
FormatCount As Integer)

Me.PageHeaderSection.Visible = (Me.Page > 1)

End Sub

'----- end of code -----

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
'Freeze' Report Header and Page Header in screen view - possible? PamB Microsoft Access Reports 3 26th Apr 2010 04:44 AM
Header Problem (page header & report header) Eva Microsoft Access 2 23rd Oct 2009 03:46 PM
Bound controls in Page Header section of Access 97 report osofuchi@gmail.com Microsoft Access Reports 1 19th May 2006 01:26 AM
Re: Page Header and Group Header viewable in preview but won't print hoenth Microsoft Access Reports 0 19th Jul 2004 05:38 PM
Supress Page Header on 1st Page of Group Header D. Mullins Microsoft Access 1 7th Mar 2004 08:07 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:07 AM.