Results 1 to 11 of 11
  1. #1
    3 Star Lounger
    Join Date
    Apr 2003
    Location
    Calgary, Alberta
    Posts
    327
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Force Password, Open Switchboard (Access 2000)

    I am trying to get the user to enter a username and password when they open Access. Depending on the username a password, I would like to open a specific switchboard(if possable) or open a form. When using the username security with Access, I can set which forms they use, but not state which switchboard or which form they can open at the start. Therefore, they get to view all the option, but only access what I gave them access to. When they click on a form they cannot access, an unfriendly error appears. Is there a way to redirect a user to a specfic form using Accesses username/password when Access is open, or do I have to make my own security?

    The other option I was thinking is to have seperate front ends for the different levels of security. It's a pain, since I would have to update 4 or 5 front ends each time I made a change.

    In a nutshell, I want to be able to use 1 front end for all users, plus have the correct switchboard activated when the user logs in

    On a side note, how can you find out what the name of all the switchboards in the system? Only the first one appears in the forms window

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Force Password, Open Switchboard (Access 2000)

    What do you mean by "all the switchboards in the system"?

    The Switchboard Manager built in to Access creates just one switchboard: a form named Switchboard based on a table named Switchboard Items. This form presents various series of options in switchboard pages; the details of these are stored in the Switchboard Items table. The SwitchboardID field in this table identifies the switchboard pages.

    If you would like to present a different switchboard page depending on the user, you will have to modify the On Open code of the Switchboard form. You can do this safely - Access never modifies the form after it has been created; the Switchboard Manager only modifies the Switchboard Items table. This is the default On Open event handler:

    Private Sub Form_Open(Cancel As Integer)
    ' Minimize the database window and initialize the form.

    ' Move to the switchboard page that is marked as the default.
    Me.Filter = "[ItemNumber] = 0 AND [Argument] = 'Default' "
    Me.FilterOn = True

    End Sub

    You would have to change the filter depending on the user name.

  3. #3
    3 Star Lounger
    Join Date
    Oct 2001
    Location
    Newport, Gwent, Wales
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force Password, Open Switchboard (Access 2000)

    Hello

    I've been toying with this problem myself, but not worked out the technicalitles.

    So far I'm using the startup form to collect the user name and password. This information is then stored as a variable in VBA. Every time a button is clicked to access a 'restricted' form the code checks the variable details (I use three items in the password data, name, password and level), if the user has clearance they get the form, if not the get a message box saying they don't have the need to use that form (or similar).

    I'm struggling with the VBA as it is reliable on some forms and not on others, I'm only doing this to improve my VBA to be honest, but that's my concept.

    HTH

    Ian

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Force Password, Open Switchboard (Access 2000)

    Storing the info in variables can be problematic. If an unhandled error occurs, variables will be cleared. It might be better to keep a hidden form open during the entire session, and storing the login data in text boxes on that form. (You could hide the startup form after the user has logged in instead of closing it.) You can refer to the text boxes the usual way:

    Forms!frmHidden!txtUsername

    Using a secured .mdw file is by far the best way to implement security; if you have set it up correctly, it is very hard to get around it. Although "home-grown" security is enough if you just want to keep people from accidentally straying where you don't want them to go, it can usually be bypassed by somebody with enough determination.

  5. #5
    3 Star Lounger
    Join Date
    Oct 2001
    Location
    Newport, Gwent, Wales
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force Password, Open Switchboard (Access 2000)

    Hans

    My problems may well be with the errors, although I'm in the habit of using error handling now I don't set it up until the code has been bug tested thoroughly. that way the editor takes me straight to my mistake rather than giving me an error number and message to work out.

    I know a decent .mdw is the best way of securing a database, but (and I'm still learning here as well) I haven't yet worked out how to use this security to stop people from opening forms that are available. I can stop them editing data, deleting data etc, but can't stop them opening a form from a button, I need to play with Access security some more.

    My suggestion was just a fairly simple way (especially if a hidden form is used) to restrict access to forms already set up.

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Force Password, Open Switchboard (Access 2000)

    Yes, you do need to play with Access security some more. With the implementation of Access security and the appropriate code in place, you can keep people from even seeing a button if you need to. All the objects in the database can have permissions set that will automatically limit who can open them, modify them, etc., not just data in tables but forms, reports, tables, queries, macros and modules. However, one thing you MUST do to achieve that is to remove all permissions from the Admin user and move that user out of the Admins group.
    Charlotte

  7. #7
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Force Password, Open Switchboard (Access 2000)

    Lots of info has been posted regarding your issue, but it's not clear if you question has really been answered. The bottom line is that the switchboard as it stands doesn't really handle the issue of users not being able to execute a specific menu option. One solution is to put in error handling for the specific error generated when a user tries to do something not permitted. Another is to have a front-end routine that modifies the table Switchboard Items which drives the Switchboard form based on the user or group who just logged in. Either involves considerable VBA.
    Wendell

  8. #8
    3 Star Lounger
    Join Date
    Apr 2003
    Location
    Calgary, Alberta
    Posts
    327
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force Password, Open Switchboard (Access 2000)

    I was browsing though the switchboard code before. But how would I find out what user has logged in after a persons logs in? What wold the filter be in that case

    Let say I have a user called Picker1 under the group Pickings. I have them getting access to 2 forms in a switchboard page. I would like to move to that page when Picker 1 logs in?

    Any ideas would be awesome. thanks [img]/forums/images/smilies/smile.gif[/img]

  9. #9
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Force Password, Open Switchboard (Access 2000)

    You find out who logged in using the CurrentUser() function. Checking the group is more difficult (at least until you get to Access 2002), but can be done - there is a description of how to do that sort of thing in the Access Developer's Handbook. Once you have the necessary information, you can use the code that is executed when a button on the switchboard is clicked, and emulate the case where the switchboard moves to a different menu. You will also need to understand the table structure and how it works with the switchboard. Frankly, the switchboard wasn't designed with this sort of thing in mind, so it will require quite a bit of tweaking to do what you describe.
    Wendell

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Force Password, Open Switchboard (Access 2000)

    As Wendell says, getting at the group requires extra coding, but the user is easy. You could use something like this (switchboard page numbers in this example are arbitrary; you can get them from the Switchboard Items table):

    Private Sub Form_Open(Cancel As Integer)
    ' Move to the switchboard page that is appropriate for the user.
    Dim lngPage As Long

    Select Case CurrentUser
    Case "Picker1"
    lngPage = 3
    Case "Shimmer"
    lngPage = 5
    Case Else
    lngPage = 1
    End Select

    Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID] = " & lngPage
    Me.FilterOn = True
    End Sub

  11. #11
    3 Star Lounger
    Join Date
    Apr 2003
    Location
    Calgary, Alberta
    Posts
    327
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force Password, Open Switchboard (Access 2000)

    OK This work WICKED!. Thanks for the solution. It was EXACTLY what I was look for. Based on this, I can make switchhboard pages for the 4 different groups (about 10 users). Thanks again so much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •