Results 1 to 6 of 6

Restricting Ceratin Users from viewing all the forms and merchantnumbers.

  1. #1
    newbie30 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2017
    Posts
    7

    Restricting Ceratin Users from viewing all the forms and merchantnumbers.

    Hi,

    The current company (Comp A) I was working in has acquired another company(lets say comp B) and hence I was given the task of merging all the data together and import the file(Excel) they were using into our access database.

    In every form possible, I gave a combo form and let the Comp A see all the data. However, I need to restrict the Comp B(new company) from viewing only certain forms(just the import button and form) and only their merchant numbers(that begin with %1801%)



    Am using SQL for all the back end. And VBA Access 2010 version.

    Kindly help!

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,678
    You need a users table, with each user having their logon id and the company they belong to. Then when the database opens, see who is using the database and restrict based on their company.

  3. #3
    Micron is online now VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    3,138
    Further to the reply, how to handle this depends in part on what type of navigation you are using. I don't use Navigation forms (or apparently whatever a switchboard form has become) so I can't help there. But if you're using your own form as a switchboard form and that form contains a means of launching other forms and their process, then show those buttons/navigation links to users based on their identity according to the table as suggested.

    If you want to get fancy, learn how to create a custom object (e.g. dbuser) which has properties such as FName, LName, LoginID (network login id), email, EmplNo, etc. etc.) then you can get these values during any process. Some people prefer TempVars for this. Regardless, you will have to check the credentials of the user for every form or report that opens, which makes me think that a switchboard form is the way to go. Then if they can see it, they can access it, which ought to negate the need for running this check for every access request. Keep in mind that other steps have to be taken if you wish to thwart anyone from bypassing these protections, such as hiding the nav pane (in the least), preventing the shift bypass, shortcut menus etc. I advocate using a split db design where the back end tables have been linked with a password. It isn't foolproof, and I'm not going to reveal how this password can be discovered, but in all things Access, controlling access is a compilation of things and cannot be achieved by implementing one aspect of protection.
    - "doesn't work" is no help.Error #s/text do. State what's happening.
    - Use code tags for code/sql; show where errors occur
    Make all suggested changes in copies of your database or to its objects

  4. #4
    newbie30 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2017
    Posts
    7
    Thanks for the reply.

    I have created 3 tables here called 1. SecurityUsers which has the login details, uemail, pwd and companyid.
    2. SecurityObjects : which lists all the forms
    3. securityPermissiosn : which the user is given permissions(read, delete, write) based on the object.(Added the companyId field here too)

    I created a global function CheckSecurityAccess that queries the permission table based on the objectId and userid..UserId is the windows userid.(ENVIRON(username)

    For every form in Access I called this function:

    If Not CheckSecurityAccess(17) Then
    CreateSecurityAccessMsgBox "Browse For File"
    Exit Sub
    End If

    To expand to this, how do I also check for the companyId. Say if the user belongs to companyId "4" show him certain forms, if "1" then he can view ALL.

    Thanks

  5. #5
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,678
    Get rid of the password, do not require the user to have a password or to log in. It is not necessary as you know who the user is based on their Windows login, and also requires a robust "forgot your password" routine (I recently forgot my Yahoo password and they do not have this service available, so I have lost 20 years of information and contacts - let this be a warning to all). Have the main form bound to the users table and when it opens (the OnLoad event), get the login from Windows and filter to that user. Now you have all the information on that form and you can use it throughout the database.

  6. #6
    Micron is online now VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    3,138
    To expand to this, how do I also check for the companyId. Say if the user belongs to companyId "4" show him certain forms, if "1" then he can view ALL.
    Include which company the user belongs to in the user table. Since you're not using a custom object, TempVar values might be a solution for you. You can do a DLookup for the company (or any other user value) and create TempVars for each value/property of the user, and assign the DLookup value to each. Seems to me that for any form that is invoked, the Open event can check the user credentials (TempVar value) and Cancel the open event (the load event cannot be cancelled). If you used a switchboard type of form as I suggested, you wouldn't have to worry about any other form. This one would show or not show the ability to open any form.

    Agree with the password thing. Forget it. Even if you use encryption on this field at the table level, it's useless if anyone can get at the table. You are preventing anyone from being able to view the db objects such as tables as much as possible, I hope.

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

Similar Threads

  1. Viewing Continuous forms
    By scoe in forum Forms
    Replies: 9
    Last Post: 10-04-2013, 12:04 AM
  2. Replies: 1
    Last Post: 05-12-2012, 10:38 AM
  3. users only need to see forms.
    By BF15 in forum Security
    Replies: 1
    Last Post: 08-25-2011, 04:25 PM
  4. Replies: 1
    Last Post: 08-10-2011, 05:28 AM
  5. access restricting users
    By jmskms in forum Access
    Replies: 2
    Last Post: 03-05-2010, 07:39 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
  •  
Tech Forums: Microsoft Office Forums