Hide NavigationButtonxxx dynamically

liddlem

Registered User.
Local time
Today, 13:28
Joined
May 16, 2003
Messages
339
Using Access2010, I have created an app using both Horizontal and Vertical navigation buttons.

I want to hide (different) buttons for (different) users - depending on the permissions.

When the user opens the front end, I pick up their domain username and use that to review their permissions.
So far, I am cycling through my Tbl_User_ACL which has the following.

USER_ID User ID Number
NavTab_ID The tab number assigned by access when it was created
CanSEE True/False

My code (paraphrased) says
Cycle through each Tbl_User_ACL record where the user_ID = LoggedInUserID
If not(CanSEE) then
Me.NavigationTabxx.visible = false
end if
Loop

My problem here is....
How do I substitute the 'xx' (Tab Number) in my code.
 
Maybe this will work for you after adaptation.

Dim blnLocked As Boolean
Dim oldPageIndex As String
Dim Disabled As String
blnLocked = Not blnLocked
If blnLocked Then Me.TabCtl27.Pages(2).Caption = oldPageIndex & "(Disabled)"


Substitute your TabCtl and Page of course.
You will also have to re-enable it with your command button co

HTH
 
Thanks for the response Burrina.
Unfortunately, that is not the solution.

When the tab is created, access names the button. eg. 'NavigationTab23' or 'NavigationTab137'
I can us a case statement as in;

Select Case MyBtn
Case 23
me.NavigationTab23.visible = false
Case 25
me.NavigationTab25.visible = false
Case 137
me.NavigationTab137.visible = false
..
..
End Select

but that seems to be a rather 'dirty' solution. I was hoping that I could dynamically say
me.NavigationButton(MyBtn).visible = false
but this produces a 'method not found' error.
 

Users who are viewing this thread

Back
Top Bottom