Filtering a form using 2 combo box criteria's together

jjake

Registered User.
Local time
Today, 14:04
Joined
Oct 8, 2015
Messages
291
I have a small search form with 2 combo boxes.

cboPlantNum (tblPlant) Field1 - PlantID - Field2- PlantNum
cboEquipmentType (TblEquipmentType) Field 1 - EquipmentTypeID Field 2 - EquipmentType

I have a search button (cmdSearch) that opens a continuous form with a list of equipment.

I would like only the equipment that meets the criteria of BOTH combo boxes to be displayed in my continuous form.
 
Select * from table where [field1]=forms!frmMain!cbo1 and [field2] = forms!frmMain!cbo2
 
Where exactly do I input this information Ranman?
 
Nevermind. I found out how to do it using the following VBA Code.

Code:
Private Sub cmdSearch_Click()
     
 Dim strFilter As String
 
strFilter = "([EquipmentType]=" & Me.cboEquipmentType & ") AND " & _
            "([PlantNum]=" & Me.cboPlantNum & ")"
Call DoCmd.OpenForm(FormName:="frmEquipmentList", WhereCondition:=strFilter)
 

Users who are viewing this thread

Back
Top Bottom