+ Reply to Thread
Results 1 to 11 of 11

Login Dialog not working

  1. #1
    Registered User
    Join Date
    10-28-2011
    Location
    UK
    MS-Off Ver
    Excel 2010 (mac)
    Posts
    10

    Login Dialog not working

    The part of three failed attempts is not working. Please help with this. Thank you!

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Login Dialog not working

    Without testing, I think its this line:

    Please Login or Register  to view this content.
    Try removing the paranetheses. If not, then please explain what the problem is exactly?

    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    10-28-2011
    Location
    UK
    MS-Off Ver
    Excel 2010 (mac)
    Posts
    10

    Re: Login Dialog not working

    The problem is that after the 3rd attempt, the message box" "You do not have access to this database. Please contact your system administrator." does not come up.

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Login Dialog not working

    This might sound like a dumb question, but does it come up after the fourth attempt or does it never come up at all.

  5. #5
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Login Dialog not working

    Try changing the way the do... loop works:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    abousetta

    P.S. It would help if you could upload a dummy workbook to test on.

  6. #6
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Login Dialog not working

    I believe you need to remove the Exit Sub from the Else part of the code. It is defeating the purpose of the loop.
    Good luck.

  7. #7
    Registered User
    Join Date
    04-19-2010
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Login Dialog not working

    I'm going to agree with OnError. Exit sub in your else block is causing you to exit and when you come back into the sub, so your attempt variable is reset to 0. Which kind of makes me think that you need to declare the attempt variable as static. You would also need to initialize that variable on the form load event to 0.

    My suggestion,
    Please Login or Register  to view this content.
    I'm really leaning at you have a variable scope issue. Each time the user clicks go, the attempts are reset to 0. With static, the number should be saved until the form is closed and is re-initialized.

  8. #8
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Login Dialog not working

    If you do not exit the sub, there should be no issue with the counter being reset. If you use a static variable, then having got the password wrong three times, you would only get one attempt the next time. Equally, having used the code correctly three times, you would only have one attempt next time - unless you restart the application.

  9. #9
    Registered User
    Join Date
    04-19-2010
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Login Dialog not working

    I was assuming that the user was clicking the button again to enter the password that would re-fire the event. Just setting the focus to the textbox wont do anything but point the user to the wrong input. They still have to resubmit the new information somehow. Having it inside a loop esentially doesn't do anything. I can only assume that without exit sub it would hit the 3 attempts quickly because there isn't anything stopping execution when the event fires, while the user enters new data. Unless .setFocus does something I am not aware of for validation. If .setFocus does halt execution then yes. Getting rid of exit sub will work.

    To fix the attempts you could reset the static variable to =0 after a sucessful login then you always start fresh after a good login.

  10. #10
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Login Dialog not working

    I think you are correct - at least that is how it ought to be working. I confess I did not really examine what the original loop was doing - I had input boxes in my mind for some reason. So yes I think you would need something like
    Please Login or Register  to view this content.

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Login Dialog not working

    Maybe this will helpPASSWORD FORM6.xls
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1