Results 1 to 7 of 7
  1. #1
    akika is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    27

    Access2016 - Access control on forms and fields

    Hi,

    I have a form in access name "form_products" with all the fields product_id, name, description, Qty, Comments, store.

    Pls, how to restrict access to this form for some users to have read-write & some read-only?
    I have a table_user with ID, employeenum_domain_sign_on_name



    thanks to help.

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    Store the user level when they log on into a Tempvar/global variable.
    Set form access levels on form load.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    i write the userID to the form (locked) at form load:
    txtUserID= Environ("Username")
    txtRights = getUserLevel(txtUserID)

    then all queries can use the txtRights box to pull data


    Code:
    Public Function getUserLevel(pvUserID ) As String
    getUserLevel= Dlookup("[Level],"tUsers","[UserID]='" & pvUserID & "'") & ""
    End Function
    

    then certain rights can open certain queries:
    Code:
    sub btnOpenQry_click() 
    select case true
       case txtRights = "M" , txtRights = "A"
           docmd.openquery "qsAdminQry"
      case else
          msgbox "You don't have rights for this"
    end select
    end sub
    or put the rights code into the query:
    select * from table where forms!fMyForm!txtRights = 'A'

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

  5. #5
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Please feel free to try my free utility:
    http://forestbyte.com/ms-access-util...access-levels/
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    I thought that at first glance, but then the fields appeared to be different.
    Worth the O/P monitoring the other thread anyway, as they appear to want the same thing.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    @Paul,

    Yes I agree. It seems similar, posted about ~same time. That's why I put in the ??
    If it isn't same user, then these two threads should be read because there seems to be a degree of overlap in requirement.

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

Similar Threads

  1. ACCESS2016 report .visible
    By HMC62015 in forum Access
    Replies: 4
    Last Post: 02-17-2022, 01:47 PM
  2. Replies: 3
    Last Post: 01-23-2018, 03:21 AM
  3. Replies: 0
    Last Post: 09-28-2015, 10:10 PM
  4. Replies: 6
    Last Post: 02-28-2015, 01:23 PM
  5. Replies: 2
    Last Post: 08-09-2014, 04:27 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