+ Reply to Thread
Results 1 to 19 of 19

Limit User record views

  1. #1
    Registered User
    Join Date
    06-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    22

    Limit User record views

    Hello

    I am not sure if this is even possible but I figured I would throw it out here and see if it can be done. I have a Access Form linked to one table, there will be people from multiple departments entering data into this form. Right now the Form shows all of the records in the database when scrolling through them with the navigation command buttons.

    I am trying to figure out if there is a way to only show records that are a part of the users department. So if I am work in Accounting the form will only show records from accounting, and not records from legal. I am thinking that this would be based off the User Name (which my form already gets), but there might be a better way.

    Thanks in Advance

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Limit User record views

    The closest I could come to this would be to suggest you that your input form is unbound and the table is updated through an update query. Further, then when individuals want to see activity in their department, then this be done through queries/reports.

    Access to queries/reports could be segregated in search forms that are restricted (visually) by UserName and department. To see how to do this step, look at this permissions menu tutorial.
    http://www.mrexcel.com/forum/microso...ns-system.html

    This may be a bigger undertaking than the results warrant, but it is an off the top of the head idea. If you decide to go down this route and need further help, post back. Good Luck,
    Alan
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    06-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Limit User record views

    Thanks Alan

    I am still reading through your link trying make sense of it. I found something similar to that here
    http://www.databasedev.co.uk/filter_current_user.html

    I got this working so that the form only displays records that match by username. I am trying to figure out how to extend this to a department. I am getting the user names from Windows not from access table.

  4. #4
    Registered User
    Join Date
    06-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Limit User record views

    The setup where a a user can only see records they have entered on in the Form works. Now I just need a way to link a user name to a department and only allow them to run reports based of their department.

    If this does not make sense let me know and I will try to re word it.

    Thanks in Advance

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Limit User record views

    You will need to build a table of user names and departments, then base your form open records on the department.

  6. #6
    Registered User
    Join Date
    06-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Limit User record views

    That is what I was thinking I would have to do. Since I am new to Access do you know of any websites explaining how to do this off the top of your head.

    Thanks in Advance.

  7. #7
    Registered User
    Join Date
    06-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Limit User record views

    That is what I was thinking I would have to do. Since I am new to Access do you know of any websites explaining how to do this off the top of your head.

    Thanks in Advance.

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Limit User record views

    In a table

    TableName
    -----------
    RecordID (PK)
    EmployeeName
    EmployeeDept

    In a form, create a combo box that lists your EmployeeName

    Look at this link on comboboxes. Scroll down to the three tutorials on combo boxes.

    http://www.datapigtechnologies.com/AccessMain.htm

    Add another control (text box) to the form for the department.

    Use this link to learn how to populate that text box.

    http://www.baldyweb.com/Autofill.htm

    Substitute the department name in your VBA for the employee name. Might have to modify code a little bit.

    Alan

  9. #9
    Registered User
    Join Date
    06-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Limit User record views

    Thanks

    I have set up the table, combo box, and text box following directions you gave. My table is called "tblUserDept" my form is "frmFileSearch" the combo box is "cmbUserId" and the text box is "txtDept". The only thing left is making the combo box and text box be hidden and auto fill. This way it will prevent anybody in legal from running a search on accounting records, since they are not authorized to view them. I tried the following code with the combo box and text box set up just like the ones on the baldyweb site.
    Please Login or Register  to view this content.
    This does fill cmbUserId box but txtDept just shows "#Name?", even though my username matches the name in cmbUserId.

    Thanks in Advance

  10. #10
    Registered User
    Join Date
    06-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Limit User record views

    Another issue that I am having is with the Query that this search form runs. In the field that I want "txtDept" to be tied to put this in the Criteria box.
    Please Login or Register  to view this content.
    The problem is that query still returns all of my records from all depatments. For all of the other fields I have the following in the "or" box stepping down one line after the other.
    Please Login or Register  to view this content.

  11. #11
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Limit User record views

    This does fill cmbUserId box but txtDept just shows "#Name?", even though my username matches the name in cmbUserId.
    What happens if you combine the two pieces of code to the load event?

  12. #12
    Registered User
    Join Date
    06-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Limit User record views

    The same thing. I also get an error message that highlights the the following code in yellow
    Please Login or Register  to view this content.
    This happens "on load" as well as "after update"

  13. #13
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Limit User record views

    Are you able to upload a copy of your db? Make sure it is sanitized for confidential material--perhaps copy it and change real entries to dummy entries for a reasonable (but not all) records. It may be easier to see a valid solution if we can work with "real" data. Run a compact and repair and zip it before uploading to reduce the size.

    Alan

  14. #14
    Registered User
    Join Date
    06-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Limit User record views

    I will do that, it may take me a little bit of time so I will probably upload it tomorrow 8/21/13.

    Thank You for helping me out

  15. #15
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Limit User record views

    No worries. Take your time so we can get this right.

  16. #16
    Registered User
    Join Date
    06-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Limit User record views

    Here is my Access file
    RIM2013.zip

    The file RIM2013_Dev is where all of my forms are at with the linked tables in RIM2013_be, you need to hold down shift to access all of the menus when opening. If you have any questions let me know (I am new to all of this so the way I have done some things tht may seem weird). The form "frmFileSearch" is where I have set up the text boxes for the userID and their department. Also I just noticed that none of my search forms are working correctly.

    If you can figure this out, you will be a lifesaver.
    Thanks in Advance

  17. #17
    Registered User
    Join Date
    06-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Limit User record views

    Hello Alan,

    I am just wondering if you have had a chance to look over my Access program. I am sure it takes a while to understand someone else's work and that it could be a while before you might be able to solve my problem.

    Thanks

  18. #18
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Limit User record views

    Still working it through and trying to understand.

  19. #19
    Registered User
    Join Date
    06-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Limit User record views

    Thanks, let me know if you have any questions

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Pivot Tables reaching record limit.
    By lifeseeker1019 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-14-2013, 06:32 AM
  2. [SOLVED] Macro to record User Name and Duration user accessed file.
    By bajdr47 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-27-2013, 04:14 PM
  3. Limit user entry
    By benjamin140 in forum Excel General
    Replies: 2
    Last Post: 03-02-2012, 11:16 AM
  4. Hiding Custom Views from end-user
    By I Am Herenow in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-27-2008, 02:58 PM
  5. [SOLVED] Limit of # of different custom views & Automate printing diff view
    By SteveM in forum Excel General
    Replies: 2
    Last Post: 12-29-2005, 10:15 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1