Results 1 to 5 of 5
  1. #1
    Admarkea is offline Novice
    Windows 10 Access 2019
    Join Date
    Nov 2024
    Posts
    1

    Smile Opening varied Access forms for individual departments, based on Access logon user detail..

    Hello All, I am new and absolutely a beginner in the Access realm, but love this program and dabbling the last week or so to build a future DB app, using my vision for form and menu use, using this to learn along the journey.

    I am stuck at the moment and really no way to move on to a new step without passing this important question, or two. Kindly assist if anyone is able so we can possibly expand and learn together.

    Scenario;

    I am using a very basic logon form and it works great for basics, for now.

    User details are stored in a user table ("tbl_User") with user details and passwords, etc. has the following headers;

    # UserID (autonumber)
    # FirstName
    # LastName
    # CoID
    # UserJobDept


    # AppUser (db username)
    # Password (user db password)

    When a user logs on they enter their username (aka "AppUser"), and their password.

    When they hit the "logon button, the user is verified simply, and then all db users arrive to a mainform, with information, overall company details, buttons to cross-over department functionality, BUT importantly their are TWO buttons on this "main form for all" which requires finesse and probably unique coding or macro (not sure).. the questions now below!

    Question 1; there are multiple staff, multiple departments such as "Spa", "Hotel", "Admin", "Customer Service" / There are multiple staff, all work in their own specific department. / When a staff member at the "all users" main welcome form" now click on a button called "btn_OpenDash" with a graphic "MyDashboard", this button click must advance the specific user with a specific department name in column "UserJobDept" to his/her own uniquely assigned department menu form such as form dedicated to "Spa" or a form dedicated to "Hotel", etc. all from this single "btn_OpenDash".

    Question 2; there are a few buttons on the main welcome form for all users. / Any user that logged in successfully arrives to the main welcome form for all, and have the ability to click on any of these extra buttons, HOWEVER, in the case of the work schedule button called "img_Roster", when any user clicks this, the db user's (aka "AppUser") very own department roster must open from a folder saved somewhere on the HDD (stored monthly in PDF) displaying his/her very own department. / The user again can only click a single button, and db access must display the corresponding correct PDF roster.. if a roster for that department is not found at the ongoing permanent link set for the department's specific PDF roster, then it simply pops up a message form "Department Roster not yet available, please try again in 48hrs", the pop can be closed by clicking a close picture, OR will close automatically after 10 seconds, and the user can continue with other work.

    Question 3; On the same all-user welcome form are other buttons such as "btn_Map", and when only staff from the Customer Service or the Hotel team click this one button "btn_Map", the map form with directions to the hotel will open. If any other departments click this "btn_Map" button, there is no response, except a small popup again form which opens to advise them of not access, it can be clicked close or will close after 10 seconds.

    Please help, your views, insights and saving grace please!!!

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    You have the user dept, so can take them direct to their respective main menu.
    You could use the built in switchboard as that is data driven. You would just need to add a dept field to filter the options.
    I did something similar for one dept, but for security levels. managers see menu options that user did not.
    Same with logon, if a team leader they went to Allocate Work Form, users went to their Work Allocation form, that read the data that the team leaders set.

    The key is use the UserDept.

    Now what happens if I can work in two or three depts? Do I have to login as a different user each time, or can I login with a option for which dept I am working in at that time?
    If I only have one dept, then take me straight to my dept menu.
    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
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    With regard Q1

    you could perhaps use something like

    docmd.openform "frm" & dlookup("UserJobDept","tblUsers","UserID=" & vUserID)

    this assumes a) that when your user logs in, the userID is stored in a variable called vUserID and b) the forms are named in line with the UserJobDept field - e.g. frmSpa, frmHotel etc.

    Alternatively include another field in your user table to identify the required form which could then populate a variable called say vUserJobDept

    q2: The same principle can be applied to your roster pdf

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Re: Q 2 - to open a particular file based on user department, are these PDFs named with department name? Explore the FollowHyperlink command and this article http://allenbrowne.com/func-GoHyperlink.html.

    And for Q 3, when Welcome form opens, code hides or displays button as appropriate for identified user. But why bother? So what if other depts open map form? It's not like this will impact data, right? If they have no need to view, they will ignore button.

    The more "user-friendly", the more code.
    Last edited by June7; 11-03-2024 at 10:04 AM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Please feel free to look at my free utility that could answer (some of) your questions, it is fairly easy to implement and being record-based it is easy to adjust (no changes to the VBA code required, just edit\add the access rule record).
    https://forestbyte.com/ms-access-uti...access-levels/
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 1
    Last Post: 04-04-2017, 06:54 AM
  2. Replies: 1
    Last Post: 08-28-2013, 02:27 AM
  3. Multi User Logon: Check Box = Diffrent Forms
    By Zantox in forum Programming
    Replies: 7
    Last Post: 11-11-2012, 01:01 PM
  4. Replies: 10
    Last Post: 03-02-2012, 11:06 AM
  5. Replies: 3
    Last Post: 01-25-2011, 09:50 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