![]() |
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. |
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. |
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 |
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 |
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 |
All times are GMT +1. The time now is 10:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com