A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

tab control on form



 
 
Thread Tools Display Modes
  #1  
Old November 16th, 2009, 02:38 PM posted to microsoft.public.access.forms
shangman via AccessMonster.com
external usenet poster
 
Posts: 10
Default tab control on form

In a form in which i have restricted access to a tab, users need to enter a
password to enter. This works fine (this code and put it into the "onchange"
section of the tab). But what i can't figure out is how to make a password
for this. I am still learning in access and would appreciate any help on how
to do this.
(code example is listed)

Private Sub TabCtl20_Change()
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 6 is selected
' show InputBox asking for password
If TabCtl20.Value = 6 Then
strInput = InputBox("Please enter a password to access this tab", _
"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"
TabCtl20.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 = "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 do not have access to this information")
TabCtl20.Pages.Item(0).SetFocus

Exit Sub
End If
End If


End Sub

--
Message posted via http://www.accessmonster.com

  #2  
Old November 16th, 2009, 03:32 PM posted to microsoft.public.access.forms
Dorian
external usenet poster
 
Posts: 542
Default tab control on form

Why not just have a table containing the userids of the users who can access
this tab and then simply do not display the tab for users not in the table
(make visible property false)?
You can get the users userid by using the fosUserName function (do a google
search).
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"shangman via AccessMonster.com" wrote:

In a form in which i have restricted access to a tab, users need to enter a
password to enter. This works fine (this code and put it into the "onchange"
section of the tab). But what i can't figure out is how to make a password
for this. I am still learning in access and would appreciate any help on how
to do this.
(code example is listed)

Private Sub TabCtl20_Change()
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 6 is selected
' show InputBox asking for password
If TabCtl20.Value = 6 Then
strInput = InputBox("Please enter a password to access this tab", _
"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"
TabCtl20.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 = "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 do not have access to this information")
TabCtl20.Pages.Item(0).SetFocus

Exit Sub
End If
End If


End Sub

--
Message posted via http://www.accessmonster.com

.

  #3  
Old November 16th, 2009, 05:12 PM posted to microsoft.public.access.forms
shangman via AccessMonster.com
external usenet poster
 
Posts: 10
Default tab control on form

Would thi smatter if there are multiple tabs on the form? I am currently the
only one who would enter this tab. The other tabs are used by numerous ppl.
The tab i am trying to restrict is for editing only.

Dorian wrote:
Why not just have a table containing the userids of the users who can access
this tab and then simply do not display the tab for users not in the table
(make visible property false)?
You can get the users userid by using the fosUserName function (do a google
search).
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".

In a form in which i have restricted access to a tab, users need to enter a
password to enter. This works fine (this code and put it into the "onchange"

[quoted text clipped - 46 lines]

End Sub


--
Message posted via http://www.accessmonster.com

  #4  
Old November 16th, 2009, 06:31 PM posted to microsoft.public.access.forms
shangman via AccessMonster.com
external usenet poster
 
Posts: 10
Default tab control on form

I figured it out, thx for the help anyways.

Dorian wrote:
Why not just have a table containing the userids of the users who can access
this tab and then simply do not display the tab for users not in the table
(make visible property false)?
You can get the users userid by using the fosUserName function (do a google
search).
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".

In a form in which i have restricted access to a tab, users need to enter a
password to enter. This works fine (this code and put it into the "onchange"

[quoted text clipped - 46 lines]

End Sub


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200911/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:46 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.