DatabaseObjects
ObjectsSearch(ByVal objCollection As IDatabaseObjects, ByVal objSearchCriteria As SQLConditions) As Collection
ObjectsSearch returns a collection of objects that match the specified search criteria. The ObjectsSearch function utilises any subsets, ordering or table joins specified in the collection. To add a set of conditions with higher precendance use the AddConditions function rather than the Add function as this will wrap the conditions within parentheses.
The following wildcard characters are used when using the LIKE operator (extract from Microsoft Transact-SQL Reference):
Wildcard character | Description | Example |
---|---|---|
% | Any string of zero or more characters. | WHERE title LIKE '%computer%' finds all book titles with the word 'computer' anywhere in the book title. |
_ | Any single character. | WHERE au_fname LIKE '_ean' finds all four-letter first names that end with ean (Dean, Sean, and so on). |
Public Function Search( _
ByVal strSearch As String, _
ByVal eType As ProductSearchTypeEnum) As Collection
Dim objConditions As SQLConditions
Set objConditions = New SQLConditions
Select Case eType
Case dbProductSearchDescriptionPrefix
objConditions.Add "ProductName", dboComparisonLike, strSearch & "%"
Case dbProductSearchDescription
objConditions.Add "ProductName", dboComparisonLike, "%" & strSearch & "%"
End Select
Set Search = DBO.ObjectsSearch(Me, objConditions)
End Function