Results 1 to 4 of 4
  1. #1
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071

    Navigation Form Menu System

    Hi I have a question on the Navigation Form Menu System. Is it possible to make certain options only available for specific users? I am in the process of combining 4 Departments Access Databases Into 1 New Database. We had a new requirement that now all 4 departments need to be able to share data. Each department had their own customer base but we were seeing a lot of cross over between the departments and nobody knew it. They've asked me to combine all 4 databases into 1 and create a front end that they can all use. I'm about 3/4 of the way done but some of the Forms are for supervisor's only. I need to figure out if I can use the Windows Login and make certain Navigation Pages only accessible to the supervisors. (Reports, Maintenance Menu for Updating some lookup tables that kind of thing) Just not sure how to go about it. Nor am I sure it's even possible. Thanks for your help

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Yes, it certainly is possible to do this. You need a function to get you the name of the current user (see below, from the Access 2010 help).

    Code:
    'Access the GetUserNameA function in advapi32.dll and
    ' call the function GetUserName.
    Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
         (ByVal lpBuffer As String, nSize As Long) As Long
    
    ' Main routine to retrieve user name.
    Function GetLogonName() As String
    
        ' Dimension variables
        Dim lpBuff As String * 255
        Dim ret As Long
    
        ' Get the user name minus any trailing spaces found in the name.
        ret = GetUserName(lpBuff, 255)
         
        If ret > 0 Then
            GetLogonName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
        Else
            GetLogonName = vbNullString
        End If
    End Function

    Then, once you have the user name (I suggest you get it when the application is started, and keep it in a global variable), you can put code in your menu system to deactivate options that the current user is not allowed to perform.


    There are several ways to do that; you can just not allow code to run, you can disable options, or you can make options not visible.

  3. #3
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    Thanks, the above function is currently in the database, I used it in another project and made it part of me template for all databases I create here. I just need to figure out how to use it in my current project. Thanks again, you gave me a direction to move in.

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936

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

Similar Threads

  1. menu system
    By CHEECO in forum Access
    Replies: 2
    Last Post: 06-19-2016, 12:26 PM
  2. Help making navigation form/main menu
    By tmpgovrel in forum Access
    Replies: 3
    Last Post: 09-06-2013, 02:41 PM
  3. Navigation Menu and Search Form error
    By pbouk in forum Forms
    Replies: 5
    Last Post: 03-06-2013, 12:42 PM
  4. Replies: 0
    Last Post: 09-25-2012, 09:16 AM
  5. File system menu for access
    By bob500000 in forum Access
    Replies: 13
    Last Post: 12-02-2011, 01:16 PM

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