Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2016

    Unanswered: ComboBox Filtering of SubForm

    Hello. I have database where part information is to be stored. There are separate tables for different part "families". The separate tables are necessary because each part family has a unique set of attributes, and as a result the columns of each table need to be different. For user simplicity, there is only 1 main form that filters through these tables using combo boxes and VBA. As each combobox is popluated, the records are filtered further and further until you arrive at a part number. While the main form is working great, I was hoping to have a subform that shows the filtered records in Datasheet view. Because the fields are dynamic from 1 part family to the next, I cannot figure out how to link the textboxes in the subform to the data being filtered by the combo boxes in the main form. Although I can follow along with VBA code, I'm relatively new to both access and VBA so I get stuck when I need to develop code froms cratch on my own. Any advice or input would be appreciated.
    Attached Files Attached Files
    Last edited by jhalfhill; 04-21-16 at 10:09. Reason: Wrong attachment

  2. #2
    Join Date
    Apr 2014
    Provided Answers: 23
    If you are going to have many combos that filter as you go, then use vb.
    youd execute it after EVERY control afterupdate

    sub FilterRecs()
    if not isnull(cboState) then   sWhere = " and [state]='" & cboState & "'"
    if not IsNull(cboName) then    sWhere = sWhere & " and [Name]='" & txtName & "'"
    if not IsNull(chkContact) then sWhere = sWhere & " and [Contact]=" & chkContact.value
        'remove 1st And
    sWhere= mid(sWhere,4)
    me.subform.form.filter= sWhere
    me.subform.form.filteron = true
    end sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts