Results 1 to 15 of 15
  1. #1
    jamieciarams is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jul 2018
    Posts
    4

    Question How to filter one combo boxed based on the selection of another in a continuous form

    Hello,

    My problem is that I would like to filter one of my combo boxes (ID_format) based on the selection of another combo box (ID_produit).

    ID_produit = product name
    ID_format= available product sizes
    ID_produit_prix = price of the product depending on the size

    When a user selects ID_produit, I only want the product sizes that have a price associated withthem to show up in ID_format... but instead all of them show up.

    In summary... i want: ONLY SHOW ME THE SIZES THAT HAVE A PRICE ATTACHED TO THEM BASED ON THE PRODUCT SELECTED.
    P.S. cascading combo boxes don't work because it is a continuous form. Thank you.

  2. #2
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    can you upload a sample db with just the form and associated tables (empty or with a couple of sample records)?

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    example: pick car make combo
    which filters the car model combo

    the cboModel query always looks at the cboMake combo.
    cboMake.rowsource=qsModels1Make
    qsModels1Make:= select [model] from tCars where [make]=forms!myForm!cboMake

    once user picks a car MAKE in the combo box, the MODEL combo resets to that 'make'.
    the 2nd combo sql looks at the 1st combo value.

    then once the user picks the MAKE, you must refresh the model list using the afterupdate event:

    Code:
    sub cboMake_Afterupdate()
      cboModel.requery
    end sub

  4. #4
    jamieciarams is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jul 2018
    Posts
    4
    Is this supposed to work on a continuous form?

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    A Cascading Comboboxes will work on any type of Form.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    Join Date
    Apr 2017
    Posts
    1,680
    Quote Originally Posted by jamieciarams View Post
    P.S. cascading combo boxes don't work because it is a continuous form.
    Because you use in WHERE clause the value of control instead of value of field!

  7. #7
    jamieciarams is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jul 2018
    Posts
    4
    Quote Originally Posted by Missinglinq View Post
    A Cascading Comboboxes will work on any type of Form.

    Linq ;0)>
    Well yeah technically it works... but if I select a certain product, the fields in the format category will temporarily disapear if it isn't related to that product. The data remains in the database, but the display will vanish. Any idea on how to make that stop?

  8. #8
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    You need to dynamically change the rowsource of the second combobox on the OnEnter and OnExit events:

    Code:
    Private Sub ID_format_Enter()
    Me.ID_format.RowSource = "qryID_format_LimitedBy_ID_produit"
    End Sub
    
    
    Private Sub ID_format_Exit(Cancel As Integer)
    Me.ID_format.RowSource = "qryID_Format_ALL"
    End Sub
    This way the combo's rowsource is only limited when it gets activated.

    Cheers,
    Vlad

  9. #9
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    Dear Jamie,

    I was also facing a similar problem. Please refer to my post
    https://www.accessforums.net/showthread.php?t=72593&page=2

    Could you please be specific, if I am not mistaken you are facing problem, that when selection is done on main field only products relating to those field are displayed in next combo box in all the records, though the data is always there in the database but it shows blank (check images posted by me on my post). And YES Cascading combo box works in continuous form with its own set of problems.

    If you try Gicu Solution please update on results, as it would help me out also.

    Thanks and Regards
    Deepak Gupta

  10. #10
    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

  11. #11
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Ahh, to kill two birds with one stone...

    Deepak and Jamie, would you please have a look at the attached file and see if that solves your problem?

    Cheers,
    Vlad
    Attached Files Attached Files

  12. #12
    jamieciarams is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jul 2018
    Posts
    4
    Thanks all. Given my unfamiliarity with code, I decided to go with the text box over combo box hack.

  13. #13
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    Dear Gicu,

    Thanks for the code, works perfectly. Hope you could have replied sooner to my post, took me couple of days to figure out the way around it. But your code is better and simpler. Thanks.

    Regards
    Deepak Gupta

  14. #14
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Glad to hear, sorry I missed your original post!

    Cheers,
    Vlad

  15. #15
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    No probs thanks for the code, it is such a simple process. Thanks.

    Gicu, could you please look into following post and see something can be done:
    https://www.accessforums.net/showthread.php?t=72286

    Thanks and Regards
    Deepak Gupta

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

Similar Threads

  1. Replies: 3
    Last Post: 06-16-2018, 11:12 PM
  2. Filter a continuous form using a combo box
    By Chky071 in forum Access
    Replies: 5
    Last Post: 05-04-2015, 08:06 AM
  3. Replies: 3
    Last Post: 04-10-2015, 10:26 PM
  4. Replies: 2
    Last Post: 09-10-2013, 09:10 AM
  5. Replies: 1
    Last Post: 11-24-2011, 07:45 AM

Tags for this Thread

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