+ Reply to Thread
Results 1 to 5 of 5

prompt for password only once

  1. #1
    Mike Boynton via OfficeKB.com
    Guest

    prompt for password only once

    I have a database I set up in Excel to track certain information on the
    stores we service. I created a userform to allow the addition of new
    stores as they come online to simplify the matter. I password protected
    the userform, which is working fine...but I would like it so that once you
    enter the password correctly, you will not be prompted for it again as long
    as the workbook is open. The issue is that as you are adding info to the
    database, you might come to a point where you have to add a store to the
    database. So you open the userform...in order to do this you are first
    prompted to enter the correct password. This is fine if the only occurs
    once, but if you have to do it several times while adding data, it gets old
    in a hurry. I can't seem to figure out how to do this. I am not a vba
    newbie, but I am no expert by any means. Any help would be greatly
    appreciated.

  2. #2
    Greg Wilson
    Guest

    RE: prompt for password only once

    This seems too simple so I think I might be missing something. Can you not
    just test the user's entry against the correct password and if it matches
    then change a public variable from its default value to whatever? Say it's
    Boolean, change it from the default value of False to True (e.g. name it
    "UserAuthorized" and change it from False to True). Henceforth, so long as
    it's True then don't require password entry. Once the WB is closed memory is
    lost and it reverts to False on reopen.

    Regards,
    Greg Wilson

    "Mike Boynton via OfficeKB.com" wrote:

    > I have a database I set up in Excel to track certain information on the
    > stores we service. I created a userform to allow the addition of new
    > stores as they come online to simplify the matter. I password protected
    > the userform, which is working fine...but I would like it so that once you
    > enter the password correctly, you will not be prompted for it again as long
    > as the workbook is open. The issue is that as you are adding info to the
    > database, you might come to a point where you have to add a store to the
    > database. So you open the userform...in order to do this you are first
    > prompted to enter the correct password. This is fine if the only occurs
    > once, but if you have to do it several times while adding data, it gets old
    > in a hurry. I can't seem to figure out how to do this. I am not a vba
    > newbie, but I am no expert by any means. Any help would be greatly
    > appreciated.
    >


  3. #3
    Mike Boynton via OfficeKB.com
    Guest

    RE: prompt for password only once

    Thats what I have been trying to do. I put a watch on the variable and it
    does toggle to true, but when the code finishes and it exits the sub, the
    variable looses it value. I can't seem to figure out what I am doing
    wrong. Maybe I need to bring this home instead of trying to work on it in
    my spare time at work.

    --
    Message posted via http://www.officekb.com

  4. #4
    Dave Peterson
    Guest

    Re: prompt for password only once

    Put it in a General module:
    Public UserAuthorized as boolean

    It may help.

    "Mike Boynton via OfficeKB.com" wrote:
    >
    > Thats what I have been trying to do. I put a watch on the variable and it
    > does toggle to true, but when the code finishes and it exits the sub, the
    > variable looses it value. I can't seem to figure out what I am doing
    > wrong. Maybe I need to bring this home instead of trying to work on it in
    > my spare time at work.
    >
    > --
    > Message posted via http://www.officekb.com


    --

    Dave Peterson

  5. #5
    Mike Boynton via OfficeKB.com
    Guest

    Re: prompt for password only once

    Thanks for the tip Dave, that did it! I had it in a sub under the
    worksheet.

    --
    Message posted via http://www.officekb.com

+ 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