asked on
set ore=CreateObject("vbscript.regexp")
ore.global=true
ore.pattern=" *, *"
txtbox="val1 ,val2 , val3,val4"
?"(""" & ore.replace(txtbox, """,""") & """)"
("val1","val2","val3","val4")
ASKER
Dim datain() As String
datain = Split(Me.SEARCH, ",")
Dim where As String
Dim i As Integer
For i = 0 To UBound(datain)
If Len(where) > 0 Then
where = where & " AND "
End If
where = where & " PNAME LIKE ('*" & datain(i) & "*')"
Next i
For example in search if I write (10,plain,44) then it should show me product no. 13
What about (plain,44,10) or (44,10,plain)?
ASKER
ASKER
ASKER
ASKER
ASKER
ASKER
Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.
TRUSTED BY
SELECT * FROM SomeTable WHERE YourField IN ('Val1', 'Val2','Val3')
If your users are entering these values with a comma between them, you can use Replace to get the snytax right:
Dim sVals As String
sValue = Me.YourTextbox Replace(Me.YourTextbox, ",", "','")
Dim sql As string
sql = "SELECT * FROM SomeTable WHERE YourField IN ('" & sValue &"')"