Full Version: Tab Control
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
grazird
Hi all,

I have a form with a tab control on it. I only want one of the tabs to be accessible to certain people, and to display an "Access Denied blah blah..." MsgBox to those who are not authorized to view the tab. I have that working, properly, which brings me to my problem. For those who are not authorized to access the tab, I would like to kick them back to whichever tab they were most recently on.

The only thing I have been able to come up with is to kick users back to a specific tab that I have coded...

Here is what I have so far:

CODE
Private Sub tabMain_Change()

    'Display error message if users attempt to go to OP tab
    If Me.tabMain.Value = 5 Then
        
        If Me.txtUserName <> "Robert Grazia" Then
            Me.tabMain.Value = 0
            MsgBox ("Access Denied")
        
        End If
    
    End If

End Sub


As you can see, when a user without proper access attempts to click this particicular tab, this code displays a MsgBox and kicks them back to the very first one.

Is there any way to write this code to send users back to whichever tab they were on?

Any help is greatly appreciated! As always, feel free to ask for any additional details!

Robert
Larry Larsen
Hi
Why not simply hide the tab if Me.txtUserName <> "Robert Grazia"..??
Then there's no tab(5) for them to click on..
thumbup.gif
grazird
Hmmm... I suppose that would work! I'll give that a shot.

Just for my own knowledge, I'm assuming that what I originally requested is not possible?

Thanks, Larry!

Robert
grazird
Hmmm... I suppose that would work! I'll give that a shot.

Just for my own knowledge, I'm assuming that what I originally requested is not possible?

Thanks, Larry!

Robert
Larry Larsen
Hi
Yes.. possible by using a global variable to hold the page number..
thumbup.gif
grazird
That sounds very tricky... I think I'll stick with your suggestion. wink.gif

Thanks, again.

Robert
Larry Larsen
Hi
Check out a : Previous Post : on the subject..
thumbup.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.