That wasn't a criticism of your question per se DUMS. I removed a post that answered your question in such a way as to leave you, and anyone using a system designed that way, exposed to severe criticism.
In the current climate security is a very important issue. Anyone storing passwords at whatever level has a responsibility to keep them very safe - as they may be a window into very much more than just your system.
It is a great deal safer for you, and anyone considering putting your own security process in place, to use a system already designed and available to you. One example is to get the UserName from the local security context (whether that be Domain or PC level) and allow/deny based on that. The Account used is easy to get (
Function to Return UserName (NT Login) of Current User). Groups less so but can be done. My systems work this way. No passwords stored. I just get the account name and check for certain group memberships. For the account name to be available the user has already proven their bona fides by logging on in the first place.
If you create a basic system that stores passwords and someone breaks into that and steals the stored passwords then you can be found to be criminally negligent and hit with severe punitive damages. Most don't appreciate just how dangerous an area this is - and it's increasingly so as time goes on. This isn't going to go away.
So, beware what you ask for. You have been warned.
PS. Yes. Your question was asked well. You were just unlucky to stumble over an area of such importance and sensitivity that I was obliged to intervene (The last thing I wanted to do was delete a post from my good friend ADezii. He's been contributing on this site even longer than I have).