Results 1 to 2 of 2
  1. #1
    KrisDdb is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    58

    Arrow Make some controls on a form invisible based on Windows user log in

    I have a form ‘frmMain’ with some labels, and corresponding listboxes and buttons. Each button when clicked opens a report/form and each listbox is coded to show the count of the records in that report/form. The frmMain also has a combo box which lists all the users in our domain. And based on the selection in the combo box, the listboxes and buttons are populated with that particular user’s data.
    Now I want the frmMain to make the listboxes and buttons invisible, based on the windows login id i.e, I have different types of users with different security levels and I want to make those listboxes and buttons invisible when a ‘regularUser’ logs in and visible when an ‘administrator’ logs in. I also want to make sure when an admin logs in and selects a ‘regularUser’ from the combo, the listboxes and buttons should be displayed. **I do not want the visibility affected based on the combo box selection. I want the windows login to do so** The combo box IDs and the windows IDs are same.
    Can anyone suggest the best way to do this?


    Appreciate your thoughts and time.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    You can get the user's network login user name with Environ("USERNAME") - yes, type it exactly as shown. Access won't recognize Environ but VBA will. Use the Environ value to get that user's category from your user table and set visibility appropriately.

    You can create a custom public function that will run Environ("USERNAME") and call that function from textboxes or queries.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 09-08-2011, 10:53 AM
  2. Replies: 13
    Last Post: 07-18-2011, 10:05 AM
  3. Replies: 6
    Last Post: 06-02-2011, 12:27 PM
  4. Replies: 10
    Last Post: 12-31-2010, 12:35 PM
  5. Replies: 5
    Last Post: 06-29-2010, 06:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums