I have 4 check boxes and associated combo boxes on a form which filter a report.
I now have these working fine thanks to the help of KenReay who gave me the following code, which is placed in the report module on the OnOpen event:
strFilter = ""
If (Forms![xyz]![chk1]) = True Then
Me.Filter = "[item1] = Forms![xyz]![cbo1]"
Me.FilterOn = True
strFilter = " AND "
End If
If (Forms![xyz]![chk2]) = True Then
Me.Filter = Me.Filter & strFilter2 & "[item2] = Forms![xyz]![cbo2]"
Me.FilterOn = True
strFilter = " AND "
End If
If chk3 End If etc
If chk4 End If etc
However, I now need to incorporate an option group also. I am using the following code for this on another form:
If (Forms![xyx]![optGrp]) = 2 Then
Me.Filter = "[itemA] = Forms![xyz]![cboA]"
Me.FilterOn = True
ElseIf (Forms![xyz]![optGrp]) = 3 Then
Me.Filter = "[itemB] = Forms![xyz]![cboB]"
Me.FilterOn = True
ElseIf (Forms![xyz]![optGrp]) = 4 Then
Me.Filter = "[itemC] = Forms![xyz]![cboC]"
Me.FilterOn = True
Else
Me.FilterOn = False
End If
How can I filter all of these items in the reports OnOpen event?
Would apprecite some more help if your still there KenReay/anyone.