Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005
    Location
    Utah
    Posts
    136

    Unanswered: Password protected form.

    This was working last week but now is not. I'm very very new to visual basic. Can anyone tell me what's wrong with my script?

    Name of Form: Password Form
    Name of Text field inside Password Form: EnterPassword

    The OK Button has the following OnClick event.


    Dim strPassword

    strPassword = "brookeevans"

    If strPassword = "" Or strPassword = Empty Then
    MsgBox "You do not have rights to access this menu."
    Exit Sub
    End If

    If strPassword = "brookeevans" Then
    DoCmd.OpenForm "Menu", acNormal
    Else
    MsgBox "Sorry, you do not have access to this form"
    Exit Sub

    End If

    DoCmd.Close acForm, "Procedure"
    DoCmd.Close acForm, "Password Form"

    Remember, I'm very new with visual basic so if you know what's wrong with my script could you write the answer very clearly for me? Thanks so much!!

    Using Access 2000/DAO 3.6
    Last edited by Zenaida; 11-28-05 at 11:22.

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    strPassword will always equal "brookeevans" because of the line:

    strPassword = "brookeevans"

    I assume you want to evaluate a textbox for the password value, in which case you could set:

    strPassword = Me.YourTextBoxName



    By the way... this is an mde or ade right?
    oh yeah... documentation... I have heard of that.

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

  3. #3
    Join Date
    Sep 2005
    Location
    Utah
    Posts
    136
    Thanks Teddy! It works great now.

Posting Permissions

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