Results 1 to 2 of 2
  1. #1
    juanss1989 is offline Novice
    Windows 11 Office 365
    Join Date
    Jan 2023
    Posts
    1

    Please help! - Filter combo box in form based on user role table

    Hello! I hope everything is going well for you.
    I have a problem and I need your help. It's simple and straightforward:
    * My database's first table has a list of countries (country ID and country name).
    * The second table includes user roles (role ID and name).
    * A third junction table connects the first and second tables in a many-to-many relationship. Many countries can be assigned to a single user role, and a single country can have multiple user roles.
    * The users are listed in the fourth table (user ID and user name). The user roles table has a one-to-many connection. Each user has just one user role.
    * The fifth and last table is divided into three columns: 1) user, 2) country, and 3) USD amount.

    This is exactly what I need. I've made a form for introducing new records to the fifth table. A combo box for the user, another for the country, and a third text box for the USD amount are provided. I simply want the second combo box to display a list of the countries available to the user based on their roles. I don't want to create a different form for each country / role because I have a lot of them. I'm seeking for a single form that numerous users can use and where each one may entry records based on the countries they've been given.
    Could you please assist me?


    Thank you so much for your time!

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,426
    from your description, sounds like you are talking about what is typicaklky called cascading combos. If so your rowsource for the combo (cboCountry?) should be something like

    Code:
    SELECT tblCountry.countryID,tblCountry.countryname
    FROM  tblJunction inner join tblCountry on tblJunction.countryID=tblCountry.countryID
    WHERE tblJunction.UserID=[cboUser]
    in the cboUser afterupdate event put

    Code:
    cboCountry.requery
    to refresh the list based on the user selected

    depending on how your form is constructed as intended to be used you may need additional code.

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

Similar Threads

  1. Replies: 3
    Last Post: 09-15-2018, 07:41 AM
  2. Replies: 3
    Last Post: 02-09-2015, 09:06 PM
  3. Replies: 3
    Last Post: 06-18-2014, 10:40 AM
  4. Replies: 19
    Last Post: 04-23-2013, 05:45 PM
  5. User role problem
    By tsn.s in forum Programming
    Replies: 2
    Last Post: 02-10-2012, 03:30 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