Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Swicthboard security 4

Status
Not open for further replies.

FLOYDBIRTH

Technical User
Nov 19, 2003
5
US
Have a good question today. Have looked for it and found nothing related to it. Say you have a swicthboard in access 2000. It is Complete. You have a button on it where you hte dba can click to go behind the swicthboard to get to your tables and such,but problem is when you customer opens the database and the swicthboard comes up the user sees the button that may say do not click for dba only. Wicth you know they will. So the question is,can or how would you put a password on just one swicthboard button in Acess 2000 so you the builder could enter the back of the database with this button.
Thank You
FLOYD [ponder]
 
The quick and awful way is to do the following:
Code:
If InputBox("Enter password:") = "secretpassword" Then
    'open the DBA-only menu
End If



But that only takes a few seconds to circumvent.  Why are you trying to restrict your users from the admin features?  If they don't obey when you say "Please don't use the admin features," they're not going to obey when you put some sort of password on MENU INTERFACE for the admin features.

If you don't trust your users, then I recommend some stronger security method than what you've asked for.
 
This is entirely doable. I have it set up on one of my databases so that depending on which group the user who logs in belong to, they can only access certain buttons on the switchboard. However, I don't know how doable it is if your switchboard is created using the switchboard manager.
You can set up a switchboard as a normal form however and then from here, it's quite easy.

You need to set up a VBA module that will serve to check which group the user belongs to, and then call it during the "on-click" event of each of the buttons on the switchboard. An example of two of the functions I have in my module are as follows:

Public Function checkadmin() As Boolean

Dim grp As Group
Dim i As Integer
Dim flag As Integer

Set grp = DBEngine.Workspaces(0).Groups("Admins")
flag = 0

For i = 0 To grp.Users.Count - 1
If CurrentUser = grp.Users(i).Name Then
flag = 1
End If
Next i

If flag = 1 Then
checkadmin = True
End If

End Function

Public Function checkreviewer() As Boolean

Dim grp As Group
Dim i As Integer
Dim reviewflag As Integer

Set grp = DBEngine.Workspaces(0).Groups("Reviewers")
reviewflag = 0

For i = 0 To grp.Users.Count - 1
If CurrentUser = grp.Users(i).Name Then
reviewflag = 1
End If
Next i

If reviewflag = 1 Then
checkreviewer = True
End If

End Function

The first one checks to see if the user logged in belongs to the Admin group. The second checks to see if the user logged in belongs to a group I have called "Reviewers". You can have as many of these as need be. I have 5 of them in my database.

Then when the user fires the On-Click event of a button on your switchboard, you have it call and check the various group functions to see if that user should be allowed access.

Private Sub Command2_Click()

If checkadmin = True Then
DoCmd.OpenForm "frmAdminArea"
Else
MsgBox "You do not have the appropriate permissions to view the Admin Form", vbInformation
End If

End Sub

Again, I'm not sure if you can apply this to a switchboard created through the switchboard manager. I went ahead and created a normal form on my own and placed the various buttons that I would need onto it and tied the code above as needed.

This may be a bit long winded but hopefully it makes sense.
[ponytails2]
 
Dear Floyd,

Both suggestions are great.

A simple way would be to use foolio12 suggestion

combined with this:

Move your 'button' that you do not want to have your user press to a far corner of the screen.
Remove any icon or text from the button.
Disable tab stop from the button.
Remove all borders from the button, make it flat, no shadow.
Finally, make the button very small.

Now, if you set it up right, only you will know where to find and press the button.

This is not fool proof, but it can be a quick fix.

Hap...

Access Developer [pc] Access based Add-on Solutions
Access Consultants forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top