There is a reason it is only working with an exact match. If you look at the text string, you will see this:
SELECT * FROM MyTable WHERE [FieldValue] Like '*red sofa baltimore*'
Which means, give me every record where the phrase "red sofa baltimore" is anywhere in the FieldValue field.
This is a problem with design, first of all, that you would have all this information in the product description field, so you are going to have to split the string into an array and then rebuild the criteria from the array.
Dim MyArray As Variant
Dim i As Integer
Dim sString As String
sString = Me.txtUnboundTextBox
i = 0
MyArray = Split(sString, " ") 'That is a space bar between the double quotes
sString = "[ProductDescription] Like '*" 'reset
Do Until i = Ubound(MyArray) + 1
sString = sString & MyArray(i) & "*' Or [ProductDescription] Like '*"
i = i + 1
Loop
'Remove Excess - removes Or [ProductDescription] Like '* from the end of the string
sString = Left(sString, Len(sString - 32))
Then pass sString to your query. You may have to play with is a bit, but you get the idea.
mmcdonal
|