[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 142
  • Last Modified:

Only Allow Specified Users to Click

Can someone please explain to me, how I can hard code login names into Visual Basic, that way when only certain users execute my program, only THEY can click this one special button I have placed.  I am thinking the Visible = True or False is the way to go, but I am not too sure on how to do it.  Again, I have a button, that I want displayed if a certain user is logged on.  If that user is not logged onto Windows, then the button simply will not be invisible.  

Please see:


for a screen shot.

  • 3
1 Solution
Stephen MandersonCommented:
Sure, give me 5 mins and ill make an example.
Stephen MandersonCommented:
Stephen MandersonCommented:
What it does it check if the username has got access and confirms it agains the username used to login. If it is = to yes it will show the Text box
Place the following code in the startup form / module

strUser = Environ("UserName")                                       ' Get login name
strUser = UCase$(strUser)                                             '   Convert login to upper case

You will now have an uppercase login name which can be validated either against a list of authorised users in your database (if accessing a db), or hardcoded within the program itself.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now