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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to assign a value to a Textbox in Report PageHeader

Status
Not open for further replies.

raabbasi

Technical User
Jun 21, 2005
52
PK
I want to assign a value, from a textbox in a form, to the textbox in the PageHeader of a report. I have tried many variations of the following syntax, but all failed:

Me.Section(acPageHeader)!txtSupplier= Forms!frmCriteria!cmbSuppliers

Seeking help.
 
Hi
You can set the Control Source to:
= Forms!frmCriteria!cmbSuppliers

Or you can say:
Me!txtSupplier= Forms!frmCriteria!cmbSuppliers

(Assuming the form is open! :))
 
You don't need to refer through the section, but just:

[tt]me!txtSupplier = ...[/tt]

You could also just use the form reference in the controlsource of the control, but

- we don't know which event you are using, what error you're getting...

should it still not work, my guess would be wrong event, try the on format event of the section.

Roy-Vidar
 
If I use the following statement in Report_Open event:

Me!txtSupplier = Forms!frmCriteria_StockSummary!cmbSuppliers

Then I get the following error:
"You can not assign a value to this object."

Although, I can solve my problem by assigning;

= Forms!frmCriteria!cmbSuppliers

to the ControlSource property of the Unbound Textbox, in the ReportHeader, on the Properties sheet.

But, I want to find out the way to code it inside the Code module.


 
Hi
You must first clear the Control Source, if you wish to use code to assign the value. That is, the control must be unbound.
 
I alredy answered your last question in my previous reply, here with a bit more detail - you can't assign values to controls in the on open event of the report. One would usually use the on format event (and sometimes, the on print event) where the control resides.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top