Ok, I didn't understand "filtering" meaning. Here is my code:
Code:
Private Sub Results_Click()
Dim RecResults As String
If (Me.Chkbox1 = False And Me.Chkbox2 = False) Or (Me.Chkbox1 = True And Me.Chkbox2 = False) Then
RecResults = "SELECT * FROM MyTable WHERE Field1=False"
If Not IsNull(txtNumber) Then
RecResults = RecResults & " AND Field2 =[Forms]![FirstForm]![txtNumber]"
End If
If Not IsNull(txtName) Then
Recresults = RecResults & " AND ((Field3 ""*" & txtName & "*""))"
End If
If Not IsNull(txtSurname) Then
RecResults = RecResults & " AND ((Field4 ""*" & txtSurname & "*""))"
End If
'Open form for displaying results
DoCmd.OpenForm "SecondForm", acNormal
Forms![SecondForm]![SubformOnThisForm].Form.RecordSource = RecResults
End If
End Sub
This code is executed from cmdButton on first form - which is only a "search" form.