Only Allow Specified Users to Click

Posted on 2004-11-17
Last Modified: 2010-05-02
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.

Question by:chrisryhal
    LVL 19

    Expert Comment

    by:Stephen Manderson
    Sure, give me 5 mins and ill make an example.
    LVL 19

    Accepted Solution

    LVL 19

    Expert Comment

    by:Stephen Manderson
    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
    LVL 5

    Expert Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now