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 do I modify a report control after report is open

Status
Not open for further replies.

SiberBob

Programmer
Aug 28, 2002
107
US
I have a report that I would like to populate with data filtered in various ways. Is there a way to programatically change the value of a label.caption in the heading area of a report after the report has been opened?

For example, I have a form with cmd buttons on it and each one will open the same report with different filters. I'd like to use one report but change the label in the heading to show the filter criteria...

Thanks

 
Let the command button being used populate a textbox on the originating form:
Command button 1 would have ........
Me.txtButtonName = "Command1"
etc.. etc.. for each button
Use the onformat event to write something like:
If forms!frmStart.txtButtonName = "Command1" Then
Me.lblIdentifier.Caption = "This is the text for 1"
Elseif forms!frmStart.txtButtonName = "Command2" Then
Me.lblIdentifier.Caption = "This is the text for 2"
... as many times as required,,,,,,,,,
End if


Frank J Hill
FHS Services Ltd.
frank@fhsservices.co.uk
 
A quick and dirty way of displaying a report's filter property is to create a text box with a control source of:
=[Filter]

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Yes, but how do I plug

Code:
=[Filter]

into the value of the lblReportHeader.caption

 
Actually, I want to plug a more descriptive string in the caption of the lblReportHeader so setting it's property to =[filter] wouldn't work...

If the report filter is [Green] = True then I want the header to say "Green Team"

and if the filter is [Red] = True then I want the header to say "Red Team"...
 
Then you'd need some code in a relevant event (on format event of the section where the label resides)

[tt]dim strTekst as string
if instr(me.filter,"green")>0 then
strText="Green Team"
else
strText="Red Team"
end if
me("lblReportHeader").caption=strText[/tt]

Roy-Vidar
 
me("lblReportHeader").caption= is just what i needed.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top