Simple code to demonstrate how to open a form with multiple criteria to display records.
here is a simple code where I use employee_Name(e_name) and Date of birth(b_date) as criteria to open employee form (Table6).
Code:
Private Sub Command9_Click()
Dim strCriteria As String
Dim strDocname As String
strDocname = "Table6"
If IsNull(Me.Text10) Then
If Not IsNull(Me.Text12) Then
strCriteria = "e_name='" & Me.Text12 & "'"
End If
End If
If IsNull(Me.Text12) Then
If Not IsNull(Me.Text10) Then
strCriteria = "b_date=#" & Me.Text10 & "#"
End If
End If
If Not IsNull(Me.Text10) Then
If Not IsNull(Me.Text12) Then
strCriteria = "b_date=#" & Me.Text10 & "# And e_name='" & Me.Text12 & "'"
End If
End If
If Len(strCriteria) > 0 Then
DoCmd.OpenForm strDocname, , , strCriteria
Else
MsgBox "Select a criteria"
End If
End Sub