How to add a password to 1 switchboard option

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmc226
    New Member
    • Oct 2006
    • 1

    How to add a password to 1 switchboard option

    Hello,
    I am somewhat a newbie to Access and am trying to find out if there is a way to isolate one button on the switchboard with a password? That one switchboard option leads to another list of options that I don't want accessible to anyone else but my small department.

    I have looked in several reference books and many different places but haven't found how to do that particular thing. Thanks! ---Dina
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32645

    #2
    Have the On Click property point to a procedure (subroutine) which, instead of calling the restricted form directly, uses an
    Code:
    InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context])
    call first to get a string which can be compared to your correct password.
    Then, only call the restricted form if the password is correct.

    Comment

    • MMcCarthy
      Recognized Expert MVP
      • Aug 2006
      • 14387

      #3
      Originally posted by dmc226
      Hello,

      I am somewhat a newbie to Access and am trying to find out if there is a way to isolate one button on the switchboard with a password? That one switchboard option leads to another list of options that I don't want accessible to anyone else but my small department.

      I have looked in several reference books and many different places but haven't found how to do that particular thing. Thanks! ---Dina
      In the current on click event of the button you have something like:

      =HandleButtonCl ick(1)

      Change this to [Event Procedure]

      Write your code to get password

      if password is correct put

      HandleButtonCli ck(1)

      Else give warning message

      The only problem with this is that this button number will always behave like this on the switchboard

      Comment

      • hardcode
        New Member
        • Oct 2006
        • 3

        #4
        Put this code behind a conrtol button on your form:

        Private Sub Command148_Clic k()
        On Error GoTo Err_Command148_ Click

        Dim stDocName As String
        Dim stLinkCriteria As String
        Dim strForm As String

        strForm = "frm_Passwo rd"
        DoCmd.OpenForm strForm, , , stLinkCriteria, , acDialog

        If strPassword = "reviewer" Then
        stDocName = "frm_Ser_needed "
        DoCmd.OpenForm stDocName, , , stLinkCriteria
        End If

        Exit_Command148 _Click:
        Exit Sub

        Err_Command148_ Click:
        MsgBox Err.Description
        Resume Exit_Command148 _Click

        End Sub

        This will generate a security box (hopefully) which when filled in with
        the password will open the secured form.
        Good luck.

        Comment

        Working...