Results 1 to 3 of 3
  1. #1
    tsn.s is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Location
    Selby, North Yorkshire, UK
    Posts
    19

    User role problem

    I am having a bit of trouble with a piece of code. It checks to see what role a user is and makes various form controls visible depending on the users role. It works fine if it is only one role that will enable the control, but I can't get it to work with multiple roles. For example, I have a user role called "Admin" and a role called "Super User". I want the super user to have use of all the controls and admin only some. I can't seem to add "Admin" and "Super User" together on the the strRole. I hope this makes sense. I have attached the code below.



    Code:
    Private Sub Form_Load()
        If strRole = "Admin" Then
            Page89.Visible = True
        Else
            Page89.Visible = False
        End If
    End Sub

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Where are you getting strRole from?

    What I do is set the TAG property to something like this:

    Admin;Super User

    And then, I can use code to display or enable/disable by something like this:

    Code:
    Me.Page89.Visible = (Instr(1, Me.Page89.Tag, "Admin") > 0 OR Instr(Me.Page89.Tag, "Super User") > 0)

  3. #3
    tsn.s is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Location
    Selby, North Yorkshire, UK
    Posts
    19
    I'm getting the strRole from a module called GVar that runs when a user logs on and tells the database what role they have. Would I replace my code with yours or use them together? Sorry I'm still getting to grips with visual basic.

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

Similar Threads

  1. Multi-user problem
    By Reaper in forum Access
    Replies: 3
    Last Post: 12-06-2011, 11:20 AM
  2. Simple problem from a newbie user
    By jimmy2x2x in forum Access
    Replies: 3
    Last Post: 10-23-2011, 04:36 PM
  3. Calendar problem for British user
    By saylindara in forum Reports
    Replies: 15
    Last Post: 08-16-2009, 05:48 PM
  4. Providing role based access
    By mrk68 in forum Security
    Replies: 3
    Last Post: 03-25-2009, 07:46 PM
  5. Problem with Read Only User
    By admaldo in forum Security
    Replies: 0
    Last Post: 04-24-2006, 11:51 AM

Tags for this Thread

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