P
Pablo
I have a form that queries a table based on multiple filters, such as Part
Number, Part Type, etc. Currently the search code is enabled to search for
one part number entered in a text box, and the search results are displayed
in a subform.
I want to be able to enhance my search functionality by allowing multiple
part numbers to be entered into the Part Number search field, and displaying
the results in the subform for the records it matches. Please help! Here's
the specific code for the search form:
Private Sub Search_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
Dim strError As String
strWhere = "1=1"
' If Title
If Nz(Me.Title) <> "" Then
' Add it to the predicate - match on leading characters
strWhere = strWhere & " AND " & "Issues.[Part Number] Like '*" &
Me.Title & "*'"
End If
If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Browse Issues", acFormDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.Browse_All_Issues.Form.Filter = strWhere
Me.Browse_All_Issues.Form.FilterOn = True
End If
End Sub
Number, Part Type, etc. Currently the search code is enabled to search for
one part number entered in a text box, and the search results are displayed
in a subform.
I want to be able to enhance my search functionality by allowing multiple
part numbers to be entered into the Part Number search field, and displaying
the results in the subform for the records it matches. Please help! Here's
the specific code for the search form:
Private Sub Search_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
Dim strError As String
strWhere = "1=1"
' If Title
If Nz(Me.Title) <> "" Then
' Add it to the predicate - match on leading characters
strWhere = strWhere & " AND " & "Issues.[Part Number] Like '*" &
Me.Title & "*'"
End If
If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Browse Issues", acFormDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.Browse_All_Issues.Form.Filter = strWhere
Me.Browse_All_Issues.Form.FilterOn = True
End If
End Sub