Results 1 to 5 of 5
  1. #1
    mbenton's Avatar
    mbenton is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2015
    Posts
    73

    Filtering a Lookup value based on other Lookup values.

    Hello,

    Any suggestions would be appreciated. I have three large source tables imported into my database. I have created queries to retrieve relevant values from fields in each source table which feeds into my form. Each field on my form that is connected to the relevant query is a lookup field. For example, one field called "Supplier_Name" another called "Supplier_Code" and a third called "Route_Number". Needless to say each of my lookup fields are very long. I am trying to filter my search based upon the selection from the previous Lookup field. Does anyone know how I can filter a lookup field's value based upon the previous lookup field selection? Each Supplier has a code and assign route(s) and I have already established these relationships. Thanks.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    To do the multi-combo box
    each combo box has a query for its recordsource.
    Here the user picks a state, then in the next combo picks a City (in that state)

    The 1st combo,(say cboStates)... User picks a state, then picks a company from the cboCity box.
    The cboStates AfterUpdate event will trigger when the user picks it, and this will update the next combo.

    Code:
    sub cboStates_AfterEvent()
     cboCo.requery
    end sub

    The cboCity query (say qsCityViaState) will reference the cboStates in the query sql
    Select [city] from tZipCodes where [ST] ='" & forms!frmMain!cboStates & "'"

    The City combo must be refreshed (cboCity.requery action) after user picks the state so it can deliver the resulting dataset.

    If there is another combo after this say cboEmps to pick employees, then the cboEmp must be refreshed after user picks cboCity.
    Code:
    sub cboCity_AfterEvent()
     cboEmps.requery
    end sub

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Sounds like cascading comboboxes. Review http://datapigtechnologies.com/flash...combobox2.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    mbenton's Avatar
    mbenton is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2015
    Posts
    73
    Very helpful, thank you.

  5. #5
    mbenton's Avatar
    mbenton is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2015
    Posts
    73
    Got it, thanks

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

Similar Threads

  1. Replies: 3
    Last Post: 05-08-2015, 11:08 AM
  2. Replies: 5
    Last Post: 11-24-2014, 02:19 PM
  3. Lookup in Form and Report filtering
    By agure in forum Access
    Replies: 15
    Last Post: 02-16-2014, 08:32 PM
  4. Replies: 5
    Last Post: 06-14-2012, 08:30 AM
  5. Lookup Values
    By jbarrum in forum Access
    Replies: 6
    Last Post: 12-31-2009, 08:58 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