Same Control in Page Header and Footer

B

bw

Should be simple? I just want a control value that appears in the Page
Header to ALSO appear in the Page Footer.

What's happening when I do this is that the Page Footer is displaying
the value of the control for the next page???

What am I doing wrong?
Bernie

--
 
M

Marshall Barton

bw said:
Should be simple? I just want a control value that appears in the Page
Header to ALSO appear in the Page Footer.

What's happening when I do this is that the Page Footer is displaying
the value of the control for the next page???

What am I doing wrong?


How are you trying to do it?

Generally, if you use a bound text box in the header, it
displays the field's value in the first record on the page.
Similarly, a page footer text box displays the value in the
last record on the page.

If you want the header and footer to dosplay the same value,
set the footer's text box's expression to =headertextbox
 
B

bw

Marshall Barton said:
How are you trying to do it?

Generally, if you use a bound text box in the header, it
displays the field's value in the first record on the page.
Similarly, a page footer text box displays the value in the
last record on the page.

If you want the header and footer to dosplay the same value,
set the footer's text box's expression to =headertextbox

I put a bound text box in the header, and it displays the correct value.
I put a bound text box in the footer, and it display the wrong value.

I have tried to set the footer's text box expression as you suggested,
but I'm not having any success, as I keep getting errors like #Name or
#Error.

My control in the header is lblTF, with a record source of TF.

Could you please show me the correct syntax for the control in the
footer?

Thanks,
Bernie
 
R

Rick Brandt

bw said:
I put a bound text box in the header, and it displays the correct
value. I put a bound text box in the footer, and it display the wrong
value.

It's not "wrong". It's just not the value you want (important distinction).

The Page Header and Footer are not specifically tied to the structure of your
data. The detail section is tied to a each single row of data. Group
header/footers are tied to when the grouped by data fields change. The report
header/footers are logically tied to the entire record set since they
essentially "wrap" the data from the front and back.

By contrast the page header/footers are tied to what? The size of paper you
happen to use, not the data. So when you place a bound control into these
sections you will get the data from whatever row in the detail section happens
to be "current" when that section is processed. That will not be the same
record at the bottom of a page as it is at the top of the page.
I have tried to set the footer's text box expression as you suggested,
but I'm not having any success, as I keep getting errors like #Name or
#Error.

My control in the header is lblTF, with a record source of TF.

Could you please show me the correct syntax for the control in the
footer?

so your ControlSource was...

=[lblTF]

....correct? I have neve tired to do anythign like this. You might have to use
code in the Page event to set the value of the footer TextBox.
 
B

bw

Thanks for the response, Rick.
However, you didn't provide me with any information I can use.
I have no idea how to print the same value for a control in a PageHeader
and PageFooter, on the same page.
Bernie

Rick Brandt said:
bw said:
I put a bound text box in the header, and it displays the correct
value. I put a bound text box in the footer, and it display the wrong
value.

It's not "wrong". It's just not the value you want (important
distinction).

The Page Header and Footer are not specifically tied to the structure
of your data. The detail section is tied to a each single row of
data. Group header/footers are tied to when the grouped by data
fields change. The report header/footers are logically tied to the
entire record set since they essentially "wrap" the data from the
front and back.

By contrast the page header/footers are tied to what? The size of
paper you happen to use, not the data. So when you place a bound
control into these sections you will get the data from whatever row in
the detail section happens to be "current" when that section is
processed. That will not be the same record at the bottom of a page
as it is at the top of the page.
I have tried to set the footer's text box expression as you
suggested,
but I'm not having any success, as I keep getting errors like #Name
or
#Error.

My control in the header is lblTF, with a record source of TF.

Could you please show me the correct syntax for the control in the
footer?

so your ControlSource was...

=[lblTF]

...correct? I have neve tired to do anythign like this. You might
have to use code in the Page event to set the value of the footer
TextBox.
 
R

Rick Brandt

bw said:
Thanks for the response, Rick.
However, you didn't provide me with any information I can use.
I have no idea how to print the same value for a control in a
PageHeader and PageFooter, on the same page.
Bernie

As I said, you can use code in the OnPage event to grab the value currently
availiable at the top pf each page. That should be the same value that your
TextBox in the PageHeader is currently displaying. Just make the TextBox in the
page Footer with no ControlSource at all and use that code event to set its
value...

Me.TextBoxName = Me!FieldName
 
B

bw

Rick Brandt said:
As I said, you can use code in the OnPage event to grab the value
currently availiable at the top pf each page. That should be the same
value that your TextBox in the PageHeader is currently displaying.
Just make the TextBox in the page Footer with no ControlSource at all
and use that code event to set its value...

Me.TextBoxName = Me!FieldName

I tried that before my last post. My actual code is as follows:
Private Sub Report_Page()
Me.TFfooter = Me!TF
End Sub
This produces the same unexpected results.
TFfooter is an unbound textbox in the PageFooter.
TF is the record source for the textbox in the PageHeader.
With the above code, page 1 and page 2 have different values for the
header, but the same values as page 2 for the footer.
This is the same result as putting a record source in TFfooter: =Me!TF
Bernie
 
B

bw

Rick Brandt said:
Perhaps the OnFormat event of the PageHeader instead of the Page
event?

YES!
The OnFOrmat event of the PageHeader did the trick.
Now that I see it work, I think I might understand why, but I would have
never guessed that this would be the way to do it.
Thanks for your help Rick!
Bernie
 
R

Rick Brandt

bw said:
YES!
The OnFOrmat event of the PageHeader did the trick.
Now that I see it work, I think I might understand why, but I would
have never guessed that this would be the way to do it.
Thanks for your help Rick!
Bernie

No problem. Glad you got it sorted out.
 

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