0
votes

I have a tabbed control (TabCtl45) in the "Detail" section of my report that that has three tabs. (Page1, Page2, Page3). I only want to show one page depending on another variable known as Fee Type. If FeeType = 1, then Page1 tab shows. If FeeType = 2, then page Page2 tab shows... etc.

I was able to make this work in "Print View" with the OnFormat event; however, I want all my data in one easy flowing page like report view. Not in separate pages like print view outputs.

The code looked like this:

If Me.FeeType = "1" Then

Me.TabCtl45.Pages("Page1").Visible = True

Me.TabCtl45.Pages("Page2").Visible = False

Me.TabCtl45.Pages("Page3").Visible = False

ElseIf Me.FeeType = "2" Then

Me.TabCtl45.Pages("Page1").Visible = False

Me.TabCtl45.Pages("Page2").Visible = True

Me.TabCtl45.Pages("Page3").Visible = False

ElseIf Me.FeeType = "3" Then

Me.TabCtl45.Pages("Page1").Visible = False

Me.TabCtl45.Pages("Page2").Visible = False

Me.TabCtl45.Pages("Page3").Visible = True

End If

How do you I get this code to work in report view from the "Detail" section of my report? There is no event that I can see working for this purpose in the properties "Detail" section.

1

1 Answers

0
votes

You can't. The Report View is rather limited, the section events (like Detail.OnFormat) simply don't run in this view. Only in Print/Print Preview.

The only thing you can do to format single records in Report View is Conditional Formatting, but that's no use to hide things.


On an unrelated note, you can simplify your code a lot by doing:

Me.TabCtl45.Pages("Page1").Visible = (Me.FeeType = "1")
Me.TabCtl45.Pages("Page2").Visible = (Me.FeeType = "2")
Me.TabCtl45.Pages("Page3").Visible = (Me.FeeType = "3")