Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referencing a textbox in the page header.

Status
Not open for further replies.

dkaplan

Programmer
Jan 29, 2001
98
US
In an Access Report, can I reference a textbox in the page header from a group header.

The layout is

Page header
[tab]myTextBox
Group Header
[tab]diferentTextBox
I want to stop differentTextBox from printing based on the contents of myTextBox. ie. if myTextBox = "x" then differentTextBox = ""


 
The value for MyTextBox comes from the query which is the datasource of the report.

To reference this value, I've tried
[Reports]![reportName].[Section]([acPageHeader]).[MyTextBox].text

also

[Reports]![reportName]![MyTextBox].text

also

me.myTextBox.Text

The intent is:

if me.myTextBox = "x" then DifferentTextBox = "y" else "z
 
If the value is in the report's record source then bind it to a control in the group header section. It doesn't have to be visible. I don't think you have provided any good reason why you can't use a control source of:
Code:
=IIf([myTextBox] = "x","Y","Z")
You would never refer to the Text property of a text box in an Access report. Use the Value property or no property.

Duane
Hook'D on Access
MS Access MVP
 
Thanks, dhookom.

It turns out that referencing that value would not have done me much good anyway. I was trying to keep a label from repeating in the in the group header, if it had already appeared in the page header.

I seem to have found the workaround I need by using the group header's onformat event.

Again, Thanks for your input.

Dennis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top