Results 1 to 3 of 3
  1. #1
    bdenton is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    10

    Question Navigation form property change

    Hello, I would like to create a front end menu by using the navagation form method. I would liek to create a table that contains each users permission level, idefitify what they can / can't see / use.



    I would like to be able to change the visible property of a tab or sub tab and bottons depending on the data in the permissions table.

    I know how to lookup the value from the table. I have tried a number of VBA methods to set this property without success. Maybe i am using the wrong value to identify if it should be true or false.

    Any assistance would be appreciated.

    B

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if you're able to look up their permission just play around with the properties VISIBLE or ENABLED.

    For instance if your user does not have access to the form 'TESTFORM' and you have a button on your main form that's ON CLICK event is to open this form you can simply set the button's visible property FALSE (me.cmd_button_name.visible = false) and they will not see a button to click in the first place.

  3. #3
    randman1 is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2009
    Posts
    25
    I think I understand what you're looking to do.

    I would handle this one of two ways depending on how complex the relationship is between Users, Permission Levels field and the desired visible tabs.

    Say you have permission levels 1 through 5 and the levels alone determine what tab page is visible. Each page has a Tag property. Set each page's Tag property to a binary string that indicates if it should be visible for that level and loop through the pages in the Open event of the form.

    Example: Page 1 is to be visible for all permission levels. The Tag property should be 11111. Page 7 is only visible for permission levels 4 & 5 so it's Tag property would be 00011. The code would look something like this.
    Code:
    Private Sub Form_Open(Cancel as Integer)
        Dim iPLevel as Integer
        Dim pg as Page
    
        iPLevel = Me.OpenArgs 'This assumes that you pass the permission level via the OpenArgs. It can be differently if necessary
        For Each pg In Me.tabMyTabControl.Pages
            If Val(Mid(pg.Tag, iPLevel, 1)) = 1 Then 
                pg.Visible = True
            Else
                pg.Visible = False
            End If
        Next pg
    End Sub
    The other way would allow you to assign visibility by user rather than level and is very similar. Add a field to the Users table like PgAuth for page authorization. This is also a binary string but the data type should be Text for future expansion. Example: Joe Shmo is to have access to pages 1, 2, 3, 6 and 8. The PgAuth field should be 1110010100 if your Tab control has 10 pages. The code would look like this:
    Code:
    Private Sub Form_Open(Cancel as Integer)
        Dim sPgAuth as String
        Dim pg as Page
    
        sPgAuth = Me.OpenArgs 'Again assumes that PgAuth is passed via OpenArgs
        For Each pg In Me.tabMyTabControl.Pages
           If Val(Mid(sPgAuth, pg.Index + 1, 1)) = 1 Then
              pg.Visible = True
           Else
              pg.Visible = False
           End If
        Next pg
    End Sub

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

Similar Threads

  1. Replies: 2
    Last Post: 08-18-2011, 10:20 PM
  2. need to use vba to change a property to table data
    By klingoncowboy4 in forum Programming
    Replies: 2
    Last Post: 08-02-2011, 06:35 PM
  3. Change form property with VBA
    By jmk909er in forum Forms
    Replies: 1
    Last Post: 10-20-2010, 08:57 AM
  4. Replies: 3
    Last Post: 10-18-2009, 09:17 AM
  5. Replies: 1
    Last Post: 08-10-2008, 01:09 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