Hi All,
I’m having the devil of a time with this one:
Am using ver. 2007 and have got the USysRibbons table and a public procedure to hide and show the ribbon at will. Most of the time this is working fine, except . . .
I have a form with a tab control on it that has 3 pages. The first page, has the main form controls on it, the other two tab pages have sub-forms on them. The form shows/hides tab pages depending on the value of the public variable strUserType.
When the form opens (with the first tab page active, and the other 2 hidden) the ShowHide ribbon code works fine and the ribbon is hidden, Depending on the value of strUserType, other tabs are shown and their sub-forms disabled and one is enabled. The pattern I have discerned here is that whenever the tab page with a sub-form is enabled the ribbon show up.
Not only can I not seem to fix it, I don’t understand why it’s happening.
Here’s my routine:
Code:
Public Sub ShowHideRibbon(strFormName)
If strUserType = "Admin" Then
If Left(strFormName, 3) = "frm" Then
Forms(strFormName).RibbonName = "ShowTheRibbon"
ElseIf Left(strFormName, 3) = "rpt" Then
Reports(strFormName).RibbonName = "ShowTheRibbon"
End If
Else
If Left(strFormName, 3) = "frm" Then
Forms(strFormName).RibbonName = "HideTheRibbon"
ElseIf Left(strFormName, 3) = "rpt" Then
Reports(strFormName).RibbonName = "HideTheRibbon"
End If
End If
End Sub
Code:
ShowHideRibbon (Me.Name)
I’ve tried re-calling the routine from the click event of the tab page (not the tab control) and also from the Change event of the tab control –though I don’t know why I’d need to call it again—neither trick worked.
I realize there’s plenty I don’t understand about tab controls as those and sub-forms give me most of my headaches in Access, and this is the place where I’ve learned the most. I would be grateful, as always for any insights.
LM