Results 1 to 3 of 3
  1. #1
    Remsky is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Location
    Netherlands
    Posts
    4

    Fetch value using an SQL query based on selection of combo box

    I have a subform with 2 fields: Type (=fixed list of 3 types) and Result (which needs to be fetched using SQL).


    I have 3 tables: Types (TypeDescription), LookUp (TypeDescription, ResultMatchID) and Results (ResultID, ResultMatchID)
    When I select Type A in the forst Combo Box, I want to look for Type A in table LookUp, fetch the corresponding ResultMatchID from that table and look for that value in table Results and fetch the corresponding ResultID. That ResultID is the ID that needs to be used in Combo Box field Results.

    Code:
    SELECT ResultID FROM Results R
    INNER JOIN LookUp L ON L.ResultMatchID = R.ResultMatchID
    INNER JOIN Types T ON T.TypeDescription = L.TypeDescription
    WHERE L.TypeDescription = "Type A"
    How can I apply this value to form field Result, when it needs to be updated after changing form field Type?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    WHERE L.TypeDescription = forms!myForm!cboBox

  3. #3
    Remsky is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Location
    Netherlands
    Posts
    4
    Thanks for your reply!
    Unfortunately I don't know how to add SQL to an event. Can you assist?
    And I need to add the result of that query to a different combo box. How to do that?

    Sorry if this is a beginner's question...

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

Similar Threads

  1. Replies: 3
    Last Post: 06-03-2015, 10:16 AM
  2. Replies: 3
    Last Post: 07-03-2013, 10:38 AM
  3. Replies: 3
    Last Post: 12-11-2012, 09:12 AM
  4. Query to fetch a rating based on another table
    By brianeveretthoffman in forum Queries
    Replies: 1
    Last Post: 11-13-2012, 12:30 PM
  5. Replies: 1
    Last Post: 10-30-2012, 10:29 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