Results 1 to 2 of 2
  1. #1
    ChrisA1967 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    7

    Filter Combo Box on a table based on previous fields values

    This should be so simple but i can't for the life of me figure out how to do it.



    3 tables tblOrders, tblCountries, tblCourierServices

    So tblCountries has a countries field:- France, Germany, United Kingdom etc

    tblCourierServices has fields Country, CourierService:- France - La Poste, France - DHL Worldwide Express, Germany - Hermes, Germany Deutsche Post, Germany - DHL Worldwide Express, United Kingdom - Royal Mail 24, United Kingdom - Royal Mail 48

    tblOrders has a country field where it gets a list of countries from tblCountries - so combo box linked to the countries field in tblCountries and the user selects the country that is no problem

    The next field in tblOrders is delivery_method - now I need it to filter tblCourierServices according to what was entered in the country field. So for example if United Kingdom is selected in the country field it only shows Royal Mail 24 and Royal Mail 48 in the combo box.

    Should be so simple. Any assistance would be gratefully received.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    combo2 source uses combo1 as criteria in the query,
    but you must refresh combo2 when combo1 is chosen....

    combo2 bound data is:
    cboCourier.rowsource = qsCourier1Country

    qsCourier1Country
    sql
    = select Couriers from tCourier where [Country]=forms!myForm!cboCountry

    so the only event you need is:
    Code:
    '----------------
    sub cboCountry_Afterupdate()
    '----------------
    cboCourier.requery
    end sub

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

Similar Threads

  1. Replies: 4
    Last Post: 03-16-2017, 03:29 PM
  2. Replies: 11
    Last Post: 09-03-2015, 11:12 AM
  3. Replies: 1
    Last Post: 10-01-2013, 09:25 PM
  4. Replies: 3
    Last Post: 07-03-2013, 10:38 AM
  5. Replies: 1
    Last Post: 03-27-2010, 06:13 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