M
Manuel
I have a tab control (with several pages) on a form and I want to be able to
prevent the user from accessing a particular page if the user is not
authorized to do so (I know how to do this part. I retrieve the users’
windows ID and then do a check against a table of authorized users). My
question is where should the code be placed so that it executes and does the
check prior to allowing the user to view the page?
I have the following code in the On Change event of the tab control which
provides a message and then redirects the users to another page, but this
method still allows the user to view the content on the page (although, they
would not be able to change data due to the redirect).
Private Sub MyTabControl_Change()
If Me.MyTabControl.Pages(Me.MyTabControl.Value).Name = "Metrics" then
<call code that checks whether user is authorized to view page. If the user
is not authorized then…>
MsgBox "You do not have access to this tab", vbCritical, "No Access"
DoCmd.GoToControl "ProjectId"
End if
End Sub
The “ProjectId†control is located on another page.
Thank you in advance for your assistance.
Manuel
prevent the user from accessing a particular page if the user is not
authorized to do so (I know how to do this part. I retrieve the users’
windows ID and then do a check against a table of authorized users). My
question is where should the code be placed so that it executes and does the
check prior to allowing the user to view the page?
I have the following code in the On Change event of the tab control which
provides a message and then redirects the users to another page, but this
method still allows the user to view the content on the page (although, they
would not be able to change data due to the redirect).
Private Sub MyTabControl_Change()
If Me.MyTabControl.Pages(Me.MyTabControl.Value).Name = "Metrics" then
<call code that checks whether user is authorized to view page. If the user
is not authorized then…>
MsgBox "You do not have access to this tab", vbCritical, "No Access"
DoCmd.GoToControl "ProjectId"
End if
End Sub
The “ProjectId†control is located on another page.
Thank you in advance for your assistance.
Manuel