Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006

    Unanswered: Filtering subform

    Good Day

    I am trying to filter a subform based on a criteria (combo box value) passed from the main form. I only want particular managers for each department to be displayed in the subform.

    My main form is called: frmSelectMgr
    My subform comprise three tabs containing subforms e.g. subformM, subformDGM, subformGM respectively

    The combobox on the main form is called cboDepartment

    The record source of my subforms has the criteria:
    SELECT tblMgt.* from tblMgt WHERE departmentId = [forms]![frmSelectMgr]![cboDepartment]

    However, it's not working.
    What should I do or preferably how can I perform such function using MS Access vba code?


  2. #2
    Join Date
    Apr 2004
    metro Detroit
    Try either requerying the subform or applying a filter to it on the change event of the combo box.

  3. #3
    Join Date
    Jun 2006
    I have included the following code in the after update of my cboDepartment but to no avail:

    strSQL = "Select * from tblManagement where"
    strSQL = strSQL & " DeptId=" & Me!cboDepartment
    Forms!frmSelectMgr!subformM.Form.RecordSource = strSQL
    Forms!frmSelectMgr!subformDGM.Form.RecordSource = strSQL
    Forms!frmSelectMgr!subformGM.Form.RecordSource = strSQL

    I get the following message: Runtime error 2001. You cancelled the previous operation.

    Help please!

Posting Permissions

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