hello again... please see the code below, purpose is to get a password for a certain tab. this example have 2 tabs, tab 1 requires password, tab 2 doesn't. I would like to know how to stop that tab from asking for a password once the authorized user entered it once. at least until he close the main form. thank you very much.
(the reason is, there will be more than 2 tabs. and the authorized user will be switching tabs often, and going back to tab 1 and entering the password over and over doesn't seem to be user friendly)
Private Sub MFTcontrolTAB1_Change()
Dim strInput As String
Dim ctl As Control
For Each ctl In Controls
If ctl.Tag = "*" Then
ctl.Visible = False
End If
Next ctl
If MFTcontrolTAB1.Value = 1 Then
strInput = InputBox("Please enter a password to access Operations", _"Restricted Access")
If strInput = "" Or strInput = Empty Then
MsgBox "No Input Provided", , "Required Data"
MFTcontrolTAB1.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "password" Then
For Each ctl In Controls
If ctl.Tag = "*" Then
ctl.Visible = True
End If
Next ctl
' If incorrect password supplied return to tab (index 0)
Else
MsgBox ("Sorry, you are not allowed to access this tab")
MFTcontrolTAB1.Pages.Item(0).SetFocus
Exit Sub
End If
End If
End Sub
(the reason is, there will be more than 2 tabs. and the authorized user will be switching tabs often, and going back to tab 1 and entering the password over and over doesn't seem to be user friendly)
Private Sub MFTcontrolTAB1_Change()
Dim strInput As String
Dim ctl As Control
For Each ctl In Controls
If ctl.Tag = "*" Then
ctl.Visible = False
End If
Next ctl
If MFTcontrolTAB1.Value = 1 Then
strInput = InputBox("Please enter a password to access Operations", _"Restricted Access")
If strInput = "" Or strInput = Empty Then
MsgBox "No Input Provided", , "Required Data"
MFTcontrolTAB1.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "password" Then
For Each ctl In Controls
If ctl.Tag = "*" Then
ctl.Visible = True
End If
Next ctl
' If incorrect password supplied return to tab (index 0)
Else
MsgBox ("Sorry, you are not allowed to access this tab")
MFTcontrolTAB1.Pages.Item(0).SetFocus
Exit Sub
End If
End If
End Sub