Results 1 to 5 of 5
  1. #1
    Robert2150 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Location
    Sparks, Nv
    Posts
    102

    Limiting records that may be viewed in a form based upon password or user name.


    I have a database where information on various buildings may be viewed, there are multiple users. How can I limit the form to only show buildings that related to a particular user?

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    usual way would be to have a user table with say

    UserPK, username, userpassword

    when the application is opened (or perhaps just the form, depends how you want it to work), the user is obliged to log in by entering their name and password which you have code to check it is valid - plenty of examples on this and other forums.

    Then your buildings table would have a field where you store the userPK of the user allowed access

    And the recordsource to your form would then have a criteria to filter on the userpk.

    For a more detailed answer you need to provide more information e.g. is it one user, one building or does a user manage more than one building? (the above will suffice for these) alternatively can more than one user manage the same building? what happens when that person is on leave? or leaves the company? do you have teams of users who all manage the same buildings between them or can userA work with userB on one building and userC on another. etc

  3. #3
    Robert2150 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Location
    Sparks, Nv
    Posts
    102

    Limiting access to records

    I have a User Table, it contains two fields "UserName" and "Password" When the user opens the program to the Main Form, they are required to enter this information. However it gives them the ability to view all buildings. Each user may manage from 1 to 5 buildings. The "Properties Table" contains all of the data for all of the buildings. I have room in that table to add additional fields, that may hold the "UserName", and or "Password" I think I have the structure to limit each user to specific buildings, however I do not know what code to attach to the opening of the main form. Any ideas?

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    From what you are saying, it sounds like you have the main form open where they can see all the properties and then they login. It should be they login, then they can see the main form.

    when the user logs in, you need to store their login uniqueID (sounds like it is their username) as a global variable or tempvar. If you are not, you need to do so.

    your properties table need to have a field to store the username of the user who is allowed access.

    Then whatever sql you have for retrieving records to display in the main form would be modified to something like

    SELECT * FROM tblProperties WHERE User=[tempvars].username

  5. #5
    Robert2150 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Location
    Sparks, Nv
    Posts
    102
    Sorry it took so long to reply. The problem is now solved, and working well. Thank You.

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

Similar Threads

  1. Replies: 4
    Last Post: 12-16-2015, 02:41 PM
  2. Replies: 19
    Last Post: 04-23-2013, 05:45 PM
  3. User to upadate Password Form
    By libraccess in forum Forms
    Replies: 2
    Last Post: 11-29-2012, 10:41 PM
  4. Form limiting records
    By yaro.kobzar in forum Programming
    Replies: 1
    Last Post: 05-21-2011, 06:50 AM
  5. Replies: 4
    Last Post: 07-28-2010, 10:27 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
  •  
Other Forums: Microsoft Office Forums