Results 1 to 4 of 4
  1. #1
    Jims Chan is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Mar 2016
    Location
    Malaysia
    Posts
    10

    combobox filter in same combobox


    Hi guys,

    i have a combobox A in form A and combobox B in subform B (where is continous), selection in combobox A will cascading the list in combobox B.
    For Combo B ( pineapple, orange, apple....), lets say if 1st record had selected for orange, can 2nd record filter the orange to be dissapear?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    not sure of the question,....
    what is selected in cbo A? orange?
    then what does cbo B have in the list?

    or is cbo A, fruit?
    then cbo B (( pineapple, orange, apple....)
    then select Orange in cbo B to filter subform?
    if THIS is the case, then cboA Afterevent, will reset the cboB rowsource.
    Code:
    sub cboA_AfterUpdate()
       if IsNull(cboA) then
            me!subform!form!cboB.rowsource = "qsAll"
       else
            me!subform!form!cboB.rowsource = "qsFilterB"
       endif
    end sub
    THEN, when you pick the item in cboB, filter the items in the subform

    Code:
    sub cboB_AfterUpdate()
       if IsNull(cboB) then
            me.FilterOn = false
       else
            me.filter = "[field]='" & me.cboB & "'"
            me.FilterOn = true
       endif
    end sub

  3. #3
    Jims Chan is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Mar 2016
    Location
    Malaysia
    Posts
    10
    Thanks ya bro
    Actually, combobox A is category of fruit, food, drink
    while combobox B is sub category of comboboxA...
    for same record in mainform, combobox B record in subform cannot not be duplicate...
    I try the code before, it not working...

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    The query row source of combobox B would have as a criteria <>Forms!MainFormName!ComboboxA

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

Similar Threads

  1. Replies: 7
    Last Post: 11-11-2014, 06:10 PM
  2. Replies: 1
    Last Post: 09-06-2011, 01:47 PM
  3. Replies: 29
    Last Post: 08-16-2011, 05:52 PM
  4. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  5. Replies: 0
    Last Post: 12-16-2009, 01:14 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