tab control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how to create a passwoard to a tab page, example, I have 5 tab pages, I would
like to keep page 4 in private, have to have passwoard to view fields...any
idea, thanks
 
Carol said:
how to create a passwoard to a tab page, example, I have 5 tab pages,
I would like to keep page 4 in private, have to have passwoard to
view fields...any idea, thanks

Crude (and not very secure) method would be to make all controls hidden and
in the Change event of the TabControl you can execute code when that
particular page is selected that prompts the user for a password. If the
correct one is supplied the code can then make all of the controls visible.

Another way would be to have some method to recognize the user when the form
is opened. If it is a user that should not see that TabPage then just make
the whole page hidden. Then they won't even know it is there. For this you
would use code to grab the Windows Login name or use Access user level
security which will force users to log in to open your app and provides a
CurrentUser() function that returns that login.
 
Carol,
Make the tab Page Visible = No in design mode, and use the main form to
prompt the user for the password. If password OK, make the Page Visible =
Yes.
Note: If a user just viewed the hidden tab page via the password, and
then moves to another record, that tab Page would still be set to Visible =
Yes (from the previous Visble = Yes... so... use the OnCurrent event of the
form to always make sure the tab Page is set to Visible = No as the user
browses from record to record.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html
"Find a job that you love... and you'll never work a day in your life."
 
In the TabControl's Change event, test for the value of the TabControl. This
represents the tab/page the user is trying to move to. If the value is the
same page as the one you are trying to protect, ask for a password. If not
suppled, reset the value to a different tab/page.

(In MyTab_Change)
If MyTab = 3 Then
' User is trying to move to 4th tab (zero based counter)
strPwd = Inputbox("Please enter a password")
If strPwd <> "pa33word" Then
' Wrong password. send user to 1st tab (zero based counter)
MyTab = 0
End If
End If
 
Back
Top