var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Filtering subform
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?
Try either requerying the subform or applying a filter to it on the change event of the combo box.
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.