Results 1 to 7 of 7
  1. #1
    sk88 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    183

    Form still opens when wrong password is typed

    So I have my main form linked to all the other forms. I have set password to protect any one from opening. The codes I have is

    Private Sub Form_Open(Cancel As Integer)
    Dim stDocName As String
    Dim stLinkCriteria As String
    Dim PassWordtxt


    PassWordtxt = InputBox("Please Type in password")

    If PassWordtxt = "password" Then

    stDocName = "frmMainMenu"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Else

    MsgBox "The password provided was incorrect - you do not have permission"

    End If
    End Sub


    It works fine except that when I type the wrong password, it shows me the MsgBox "The password provided was incorrect - you do not have permission" and then opens my main form.



    Any suggestions anyone?

  2. #2
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254

    sk88 -

    Try -

    If PassWordtxt = "password" Then

    stDocName = "frmMainMenu"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Else

    MsgBox "The password provided was incorrect - you do not have permission"
    Cancel = True
    End If
    End Sub

    Hope this helps,

    Jim

  3. #3
    sk88 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    183
    That works!!

    Thanks Jim!!

  4. #4
    sk88 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    183
    Hi Jim,
    Question... is there a way where I can hide those characters from showing when typing password?

    Like... I would definitely love to have my password as ***** when typing it for security and privacy issue.


    any suggestions anyone?

  5. #5
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254

    sk88 -

    I don't know a way to mask the characters while using an input box. That's not to say there isn't a way, I just haven't encountered one.

    I usually use create a password form (modal & unbound) with an unbound textbox and set the input mask of the textbox to Password. So, in your case, instead of the input box, open the password form, have user type in password, check password, if correct, close password form and open the other form.

    Hope that helps,

    Jim

  6. #6
    sk88 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    183
    Thanks Jim for your help!

  7. #7
    JohnB47 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    19
    Quote Originally Posted by sk88 View Post
    Hi Jim,
    Question... is there a way where I can hide those characters from showing when typing password?

    Like... I would definitely love to have my password as ***** when typing it for security and privacy issue.

    any suggestions anyone?
    Try going to the text box you use for password entry and change it's 'Input Mask' property to 'password'.

    Hope that helps.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 04-11-2011, 10:55 PM
  2. Replies: 3
    Last Post: 03-31-2011, 11:07 AM
  3. Replies: 1
    Last Post: 03-07-2011, 10:48 AM
  4. Form opens for only seconds
    By MFS in forum Programming
    Replies: 5
    Last Post: 11-04-2010, 09:33 PM
  5. Get value typed in for a Parameter query
    By terryvanduzee in forum Forms
    Replies: 1
    Last Post: 10-14-2009, 03:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums