Dear users,
I am now trying to secure certain "pages" of my main form. About three sections of my tabcontrol must be password protected.
I had it working through a control button with pw protection but my users needed more features:
(below I have posted my code)
- I want the users to enter the password in another form "dialox box pw" with an password inputmask (goal is to not show the input)
- Once entered the users is free to go. Now they have to enter the pw for every record they select (since it is a private sub I guess)
Hope you can help me. A 4 hour browse on this great forum and others has helped but I am stuck now...
Thanks a lot in advance
Haio
I am now trying to secure certain "pages" of my main form. About three sections of my tabcontrol must be password protected.
I had it working through a control button with pw protection but my users needed more features:
(below I have posted my code)
- I want the users to enter the password in another form "dialox box pw" with an password inputmask (goal is to not show the input)
- Once entered the users is free to go. Now they have to enter the pw for every record they select (since it is a private sub I guess)
Hope you can help me. A 4 hour browse on this great forum and others has helped but I am stuck now...
Thanks a lot in advance
Haio
Code:
Dim strInput As String
Dim ctl As Control
' Hide controls on tab until correct password is entered
For Each ctl In Controls
If ctl.Tag = "*" Then
ctl.Visible = False
End If
Next ctl
' If tab page with Tab Index of 1 is selected
' show InputBox asking for password
If Toggle159.Value = True Then
strInput = InputBox("Please enter a password to access FAR data","Restricted Access")
' Check if value is entered into InputBox
' If no value entered display MsgBox
If strInput = "" Or strInput = Empty Then
MsgBox "No Input Provided", , "Required Data"
TabCtl49.Pages.Item(0).SetFocus
Exit Sub
End If
' Check InputBox value and if value is a match
' display tab and unhide hidden fields
If strInput = "MYPASSWORD" 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 do not have access to this information")
TabCtl49.Pages.Item(0).SetFocus