Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Posts
    44

    Question Unanswered: Field Permissions

    Hi there,

    Does Access allow field permissions? i.e. If a user is restricted to view only a couple of fields, is there any code to view this particular field only if for example, the user is Administrator? and Read Only Users view all fields.

    Thanks for your help.

    Smilla

  2. #2
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    Here's a cute little trick that's easy to use:

    Decide how you want to define the user's security level. This is one of the few places a "Public Variable" is appropiate.

    Let's say you have 3 levels of security:
    1: low - can see few things
    2: medium - can see some things
    3: high - can see everything

    In a module, add the line:
    Code:
    Public pubSecLevel As Integer
    In your initial form's "Open" event, assign the appropiate security level to the public variable.

    Then, on each form with restricted controls:
    In the Tag property of each control you want to respond to security level, put the security level - just the number.

    Then in the Open event, put the following:
    Code:
    Dim ctl As Control
        For Each ctl In Me.Controls
            If Len(ctl.Tag & "") > 0 Then
                If Val(ctl.Tag) > pubSecLevel - 1 Then ctl.Visible = True Else ctl.Visible = False
            End If
        Next
    Actually, this little "control" loop is very useful for a lot of things.

    Have fun

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •