form security

Discussion in 'Access Security' started by Nora Ware, Aug 16, 2010.

  1. Nora Ware

    Nora Ware Guest

    Nora Ware, Aug 16, 2010
    #1
    1. Advertisements

  2. Nora Ware

    Gina Whipp Guest

    Nora White,

    Something like...

    If Me.txtPassword = "PutYourPasswordHere" Then
    DoCmd.OpenForm "NameOfYourFormHere"
    Else
    MsgBox "You do not have permission to enter this area!"
    DoCmd.Close
    End If

    ....should work. Place in the On-Click of the button that opens the form.

    --
    Gina Whipp
    2010 Microsoft MVP (Access)

    http://www.regina-whipp.com/index_files/TipList.htm

    When using a button to open a form, Can I put a password on this action?
    What they are opening has private information, they need to know the
    password to see it.

    Submitted via EggHeadCafe - Software Developer Portal of Choice
    Book Review: Excel 2010 - The Missing Manual [OReilly]
    http://www.eggheadcafe.com/tutorial...w-excel-2010--the-missing-manual-oreilly.aspx
     
    Gina Whipp, Aug 16, 2010
    #2
    1. Advertisements

  3. On Mon, 16 Aug 2010 15:29:53 -0400, "Gina Whipp"

    This works, but what if in the future we can open the form using a
    different method, such as the Navigation Pane, a Ribbon, etc.? I think
    it's much better to write code in the Form_Open even because it will
    always run regardless of how it was opened:
    If g_strPassword <> "PutYourPasswordHere" then
    Cancel = True 'Stop opening the form.
    End If
    This assumes we have previously saved the password in global variable
    g_strPassword.

    -Tom.
    Microsoft Access MVP

    -Tom.
    Microsoft Access MVP
     
    Tom van Stiphout, Aug 17, 2010
    #3
  4. Nora Ware

    Gina Whipp Guest

    Tom,

    In the On_Open event would be a *much* better place but the OP did say they
    already use a button...

    --
    Gina Whipp
    2010 Microsoft MVP (Access)

    http://www.regina-whipp.com/index_files/TipList.htm

    On Mon, 16 Aug 2010 15:29:53 -0400, "Gina Whipp"

    This works, but what if in the future we can open the form using a
    different method, such as the Navigation Pane, a Ribbon, etc.? I think
    it's much better to write code in the Form_Open even because it will
    always run regardless of how it was opened:
    If g_strPassword <> "PutYourPasswordHere" then
    Cancel = True 'Stop opening the form.
    End If
    This assumes we have previously saved the password in global variable
    g_strPassword.

    -Tom.
    Microsoft Access MVP

    -Tom.
    Microsoft Access MVP
     
    Gina Whipp, Aug 19, 2010
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.