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

Change label in report header based on criteria 2

Status
Not open for further replies.
Oct 24, 2002
512
0
0
US
I'm trying to follow the advice I found at thread181-48619 but can't get it to work. I end up with no report title at all.

I declared GetReportTitle as a public variable in a standard module.

I have this code in a Select Case statement:

GetReportTitle = "Need PO"
DoCmd.OpenReport "rptInvoiceBalanceDue", acViewPreview, , "[OrderNumber] like 'Need PO'"

In the report header I have a label called ReportTitle.

This is my report's open event:

Private Sub Report_Open(Cancel As Integer)
ReportTitle.Caption = GetReportTitle
End Sub

The report shows the correct data but no report title.

Can anyone see what I'm doing wrong?


Ann
 
Hi

Do not know if it matters, but I would normally put the


ReportTitle.Caption = GetReportTitle


in the on format event of the section containing the label ReportTitle

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi Ken. My label is in the Report Header section which has no Format event. Other ideas?

Ann
 
I can't believe I just said the Report Header section has no Format event. Egads! I was looking at the properties of the Report rather than the Report Header.

At any rate, putting my code in the Report Header makes no difference. Again, any other ideas?

Ann
 
Hi

Afraid not..

I would normally do this pretty much as you are (now), ie put the code in the on format event of the report header, only differemce is I would normally use the content of the control from the form, from which I ran the report, so I would have something like:

MyLabel.Caption = Forms!MyForm!MyControl

but this is essentially the same as you have, just substituting an open form variable for a global variable, I do not see why that should make a difference

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thanks for the feedback, Ken. I'll keep plugging away at it and post back here if I figure it out.

Ann
 
Ken

Your advice was spot on - worked for me to solve a similar problem.

Have a star!

John R
 
Ken, I was able to follow your advice successfully in a new database but still can't figure out why I can't get it to work in my original database. Too weird! Anyway, I wanted to come back and give you a star because I'll be able to use this advice in future applications. Thanks!

Ann
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top