Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2004

    Unanswered: Password protect a switchboard item

    Is bit possible to protect a switchboard button with a password?
    ie: switchboard1, item no2, command1, argument4.
    So when a user navigates to that switchboard button they will be prompted for a password.



  2. #2
    Join Date
    Nov 2004
    There is a way but I'll have to look through my records from the past, sure I have done that. It involved editing the code on the switchboard form itself.
    Oll have a dig.


  3. #3
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    That would take a bit of vba, nothing terribly nasty.

    Do you want a single hard-coded password or are you looking to setup user-level security?

    If it's just a single password, you can setup a basic if statement in the code.
    If InputBox("Enter your password", "Enter Password") <> "some password" Then
       MsgBox "Incorrect password"
       Exit Sub
       'normal code that's in your switchboard
    End if
    **Note that you would be advised to lock the vba code if you use this method, as your password is in plain view of anyone viewing the code editor.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Nov 2004
    . .

  5. #5
    Join Date
    Nov 2004
    Try this code in the Switchboard code.
    Suppose you want to protect the button that gave you a menu named 'Top Secret' that would have a switchboard ID, lets say it is 20 (you will have to find this out for yourself by viewing the data list for the switchboard and placing the 'switchboardId' field on your switchboard.

    Private Sub Form_Current()

    ' Update the caption and fill in the list of options.

    Me.Caption = Nz(Me![ItemText], "")
    If Me.SwitchboardID = 20 Then
    Dim x As String
    x = "password"
    Dim y As String
    y = InputBox("Please Enter a Valid Password", "Password required")
    If x <> y Then
    MsgBox "Wrong password", , "Invalid Password"

    'CODE NEEDED TO GO BACK TO THE PREVIOUS SWITCHBOARD ITEM ie SwitchboardId = 4 'Not top secret'

    End If
    End If

    End Sub

    Sorry not sure how to go back to the previous switchboard item in code.


Posting Permissions

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