I have a report that has 3 parameters to be entered when running the report: start date, end date, and an option to enter 1-7 to pull data for a specific utility. I can get the dates to appear on the report header just fine. The specific utility data option returns a value of 1-7 and I want to run code so that if the value is 1 then the unbound field shows ABC or if the value is 2 it shows XYZ, etc. I have an Event Procedure in the report OnFormat that does what I want, but when the report is viewed in Access 2007 it doesn't show up. This works just fine if I open the report in Access 2003, but not in Access 2007. Obviously, something has changed in how this works and I'd appreciate someone helping me figure out what I need to do differently.
I have the Utility field captured in the Report Header section, but not visible. Then I have the following code in the OnFormat of the Report Header:
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
If Reports!UtilityRequests_rpt!Utility = "1" Then
Me.ElecUtil = "Progress Energy"
ElseIf Reports!UtilityRequests_rpt!Utility = "2" Then
Me.ElecUtil = "Duke Energy"
ElseIf Reports!UtilityRequests_rpt!Utility = "3" Then
Me.ElecUtil = "Electric Cooperatives"
ElecUtil is the name of the unbound textbox and Utility is the field name that has the value of 1-7 in it which is captured in the Report Header, but not visible.