
hi,
I am using a tab controlled form of 5-6 tabs and want to protect 3-4 tabs with a password. Password code is working but not able to hide the data on the forms during the time when I entered the password. Not sure how to use the tag property? ""HELP PLEASE""
Private Sub TabCtl0_Change()
Dim strInput As String
Dim ctl As Control
If ctl.Tag = "*" Then
ctl.Visible = False
End If
Next ctl
If TabCtl0.Value = 1 Then
strInput = InputBox("Please enter a password to access this tab", _
"Restricted Access")
If strInput = "" Or strInput = Empty Then
MsgBox "No Input Provided", , "Required Data"
TabCtl0.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "***" Then
For Each ctl In Controls
If ctl.Tag = "*" Then
ctl.Visible = True
End If
Next ctl
Else
MsgBox ("Sorry, you do not have access to this information")
TabCtl0.Pages.Item(0).SetFocus
Exit Sub
End If
End If
End Sub
also
Private Sub Form_Current()
Dim ctl As Control
For Each ctl In Controls
If ctl.Tag = "*" Then
ctl.Visible = False
End If
Next ctl
End Sub