Filtering a Subform Using Multiple Combo Boxes

CWellard

New member
Local time
Today, 08:08
Joined
Feb 6, 2012
Messages
3
Morning all,

I am new to Access and to this forum but looking for a little help with a database.

I am trying to filter a subform based on two combo boxes.

Database information;

Form - frm_twr
Combo box 1 - TowerCombo
Field to filter 1 - Tower Number
Combo Box 2 - Outage Combo
Field to Filter 2 - Outage/Non Outage
Subform - frm_Matrl Lst subform
Subform populated by query - qry_Matrl Lst



I already have the subform filtering using 'TowerCombo' of the main form to filter the 'Tower Number' field of the query using the following VBA code;

Private Sub TwrCombo_AfterUpdate()
' Find the record that matches the control.
Dim Twr As Object


Set Twr = Me.Recordset.Clone
Twr.FindFirst "[Tower Number] = '" & Me![TwrCombo] & "'"
If Not Twr.EOF Then Me.Bookmark = Twr.Bookmark

End Sub


I would now like to add an AND statement to return a filtered subform for both 'Tower Number' and 'Outage/Non Outage'

Also it would be nice to be able to clear all the filters with the click of a button. I've seen this done in other threads so could grab it off there but thought I'd mention it.

If there is any other information you require please let me know. I can't upload the actual database as I don't think the company I work for would approve but if needs be, I can recreate it with changed fields and data so that you can demonstrate on the replica instead.

Any help or advice would be greatly appreciated.

Thanks in advance.

Kind Regards,

Chris.
 
Sorry,

obviously the first combo box is called 'TwrCombo', not 'TowerCombo'.
 

Users who are viewing this thread

Back
Top Bottom