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

    Unanswered: Password protect a switchboard item

    Hi,
    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.

    Thanks

    Saltman

  2. #2
    Join Date
    Nov 2004
    Posts
    64
    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.

    Franki

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    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.
    Code:
    If InputBox("Enter your password", "Enter Password") <> "some password" Then
       MsgBox "Incorrect password"
       Exit Sub
    Else
       '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
    Posts
    64
    . .

  5. #5
    Join Date
    Nov 2004
    Posts
    64
    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], "")
    FillOptions
    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.

    Franki

Posting Permissions

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