Results 1 to 3 of 3
  1. #1
    fitzdesignz is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jun 2018
    Posts
    1

    Filtering Combo box From Another Combo box based on a Multi-valued Field

    I have a form where among other things two combo boxes exist. One is cboProcedureRoom and cboAppointmentTime. I want to limit the values in cboAppointmentTime based on the selection in cboProcedureRoom.



    This query is placed in Row Source:
    Code:
    SELECT tbl_AppointmentTimes.ApptTimes, tbl_AppointmentTimes.Room 
    FROM tbl_AppointmentTimes 
    WHERE (((tbl_AppointmentTimes.Room) In (Forms!frm_ScheduleApptEdit!cboProcedureRoom)));
    tbl_AppointmentTimes.ApptTimes is a standard single value field with times listed in increments of 30 minutes ( 8:00, 8:30, 9:00 etc..)
    tbl_AppointmentTimes.Room is is a multivalued field that indicates which room should be used for that time slot.

    tbl_AppointmentTimes
    TimeID -----ApptTime-----Room
    1 --------------8:00------- 1,2,3,4,5
    2 --------------8:30-------
    3 --------------9:00------- 4
    4 --------------9:30------- 1,2,3,5
    5 --------------10:00------- 4

    Basically rooms 1,2,3 and 5 schedule every 90 mins and room 4 schedules every 60 mins

    On my schedule appointment form I want the cboAppointmentTime to limit the results to the times available to that room. So if the user selects room 2 from the cboProcedureRoom the only options in the cboAppointmentTime is 8:00 and 9:30 or if they select room 4 they get 8:00, 9:00 and 10:00 as options.


    If I change the multivalue field to a single value field this works as it should. but then I'm only limited to one time slot per room. : (

    I'm new to access so please accuse me if my terminology is off.

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,973
    Although I wouldn't often suggest this you could use five Boolean fields Room1, Room2 etc in place of your MVF Room field.
    Or better still, just have 2 Boolean fields: Room4 and Other
    Set the values true for the times where each room has appointments.
    In the after update event for your room combo, set the row source for the other combo using a select case set of statements.

    It's a unnormalised solution which is why I wouldn't normally suggest it, but better than a MVF and perhaps ok here.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,402
    Multivalued fields generally can be replaced by a Many-to-Many relationship setup.
    Attached is a DB with a table for rooms, a table for appointment times and a junction table to join them.
    The scheduling form has a dropdown for the room number, and side by side listboxes to assign appointment times to the chosen room.
    Also included are a couple of reports to show the scheduling.
    The db does not account for overlap if scheduling can begin on the half hour.
    If you don't schedule on the half-hour, just delete those rows in the AppointmentTimes table and all is well.
    If you do schedule on the half hour, the DB needs modification to forbid overlapping times within a room for the 90 minute rooms.
    Last edited by davegri; 06-17-2018 at 12:39 AM. Reason: Clarity

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

Similar Threads

  1. Replies: 4
    Last Post: 06-12-2018, 06:22 AM
  2. join two tables on multi-valued field
    By smudger in forum Queries
    Replies: 3
    Last Post: 06-17-2012, 03:12 AM
  3. Replies: 5
    Last Post: 03-12-2012, 02:58 AM
  4. Multi Valued field sort
    By bugman61 in forum Reports
    Replies: 2
    Last Post: 08-06-2011, 11:45 AM
  5. Append Query - Multi-Valued Field
    By catat in forum Queries
    Replies: 0
    Last Post: 05-11-2010, 01:52 PM

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