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

Dynamic Report Title 1

Status
Not open for further replies.

g3a3n3n3

Technical User
Aug 6, 2003
43
0
0
AU
Hello,

I'm not to sure about whats the best way to do this. I have a report that runs of a cross tab query. The query (and then subsequently the report) gets it's parameters from a form.

On the form I have a combo box that picks up the "Organisation name" that the user wants to run the report on. This "Organisation name" is what appears on the title of the report.

What I would like is to be able to have a text box that also sits on the same form and that a user will be able to enter any "title" into this box. If this textbox is left blank then the title on the report should be what the user selected from combo box. And if the user types something into the text box then this should be the title.

Anyone know if this is possible?

All help is much appreciated.
Ta
Gillian [pc2]
 
Hi

Assuming the form is open at the time the report runs, in the onformat event of the section where the head is:

txtheader = Nz(Forms!MyForm!txtHeader,Forms!MyFormMyCombo)

using your own control names of course

should do it

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
The only way to pass data to a report is through a query or through a global variable. So you could either generate the SQL from the form and have one field contain the organisation name or use a global variable to store it in and use the variable in the report's onPrint or onFormat event.

Best regards
 
Try setting the control source of the report text box to something like this:
Code:
=IIf ([Forms]![YourForm]![txtTitle] Is Not Null,[Forms]![YourForm]![txtTitle],[Forms]![YourForm]![YourCombo])
If the user has entered a title that will populate the text box, otherwise the combo box selection will....

Hoc nomen meum verum non est.
 
Thanks for the help everyone!!

CosmoKramer your solution worked perfectly.

I always forget about the double I on the If (but I guess thats just me)

Thanks again everyone.
[smile]
 
Dear my friend,

may be u can try this :
TxtRPT = textbox that u put in your report
TxtFrm = textbox that u put in your form
FRMTest = Name of Forms behind the report

and then......

in the "control source" on the report (in the TxtRPT) write this : =Forms!FrmTest.TxtFrm

I hope it can work

Best regards,


Yulius
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top