Results 1 to 6 of 6
  1. #1
    MichaelA is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2019
    Location
    Wisconsin
    Posts
    139

    Is it possible to set a query criteria based on the choice made in a combo box in a form.


    I have a cascading combo box, the first is to select a name or nameID, the second combo box's row source is a query. When I run the query I filter it, choosing a person's name to get just their information. Can this filter or query criteria be set by choosing the name in the first combo box?

    Thank you!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

  3. #3
    MichaelA is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2019
    Location
    Wisconsin
    Posts
    139
    Quote Originally Posted by orange View Post
    More info on comboboxes than you expected at https://www.techonthenet.com/access/...oxes/index.php
    Thank you but I don't see anything in there about queries.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Can you post the "query sql" that is the rowsource of your second combo?

    You could have a vba routine that gets executed on the afterUpdate event of combo1.
    you would ensure the selection in first combo is valid, then use that value in the where clause of the query...
    if I'm following your set up.

    You want to run query X after selecting some relevant value from combo1?

  5. #5
    MichaelA is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2019
    Location
    Wisconsin
    Posts
    139
    I got it figured out. Thank you! Here's what I came up with.

    SELECT DISTINCT qryMissingAssignments.StuID, qryMissingAssignments.FirstName, qryMissingAssignments.CourseID, qryMissingAssignments.AssignID, qryMissingAssignments.Assignments
    FROM Students, Courses INNER JOIN qryMissingAssignments ON Courses.ID = qryMissingAssignments.CourseID
    WHERE (((qryMissingAssignments.StuID)=[Forms]![Grades]![StudentID]) AND ((qryMissingAssignments.CourseID)=[Forms]![Grades]![CourseID]))
    ORDER BY qryMissingAssignments.AssignID;

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

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

Similar Threads

  1. Replies: 18
    Last Post: 06-20-2019, 02:46 PM
  2. Replies: 7
    Last Post: 09-14-2017, 02:24 AM
  3. Replies: 3
    Last Post: 07-03-2013, 10:38 AM
  4. Replies: 3
    Last Post: 12-11-2012, 09:12 AM
  5. populate boxes based on combo box choice
    By Mattm1958 in forum Forms
    Replies: 13
    Last Post: 08-30-2010, 02:09 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