Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Restricting Field Access (2003)

    Hi, I will like to prevent some users modifying the data of a drop down box on a form. I already have the users and groups security setup. I dont want to hide the field. Is there a vba code for this. Appreciate any help.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Restricting Field Access (2003)

    You can put code in the On Open or On Load event of the form to set the Locked property of the combo box to True or False depending on the user. You can use CurrentUser to find out the Access login name, if you need to know if CurrentUser is member of a specific group, see Microsoft Access Security FAQ available in the Download Center (there is an online version of this document, but the page times out at the moment).

  3. #3
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Restricting Field Access (2003)

    Thank you so much hans, I read the document but it seems that it does not talk about restricting a determine field in a form. I found some stuff about restricting some people from table and queries.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Restricting Field Access (2003)

    There is no built-in support for limiting access to specific fields in a table or query. As I indicated in my previous reply, you can do this at the form level by placing code in the On Open or On Load event. Here is a crude example:

    Private Sub Form_Load()
    Select Case CurrentUser
    Case "Designer", "Manager", "Anne C"
    Me.SomeControl.Locked = False
    Case Else
    Me.SomeControl.Locked = True
    End Select
    End Sub

    If you want to limit access based on group membership, you can use the functions from the section "How can I obtain group and user membership information programmatically?", for example the faq_IsUserInGroup function:

    Private Sub Form_Load()
    Me.SomeControl.Locked = (faq_IsUserInGroup("PowerUsers", CurrentUser) = False)
    End Sub

  5. #5
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Restricting Field Access (2003)

    Thank you so much Hans. You are always a live saver.

Posting Permissions

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