G
Guest
I am using Access 2002. I want to create a search bar in my form using a text
box. I plan to split out each word the user enters in the text box and then
build a query that filters these words.
I'm getting a "Type Mismatch" error at the moment, and I'm unsure why.
Here's the code:
Dim varSearchArray As Variant
Dim strWhereSQL As String
Dim itm As Variant
'split out the text entered in the search bar
varSearchArray = Split(DescSearch, " ")
'add each word to the where clause of the query
For Each itm In varSearchArray
strWhereSQL = strWhereSQL & " OR (((tlkpMediaCode.Desc)='" &
varSearchArray(itm) & "'))"
Next
strSearchSQL = Right(strWhereSQL, Len(strWhereSQL) - 4) & ";"
box. I plan to split out each word the user enters in the text box and then
build a query that filters these words.
I'm getting a "Type Mismatch" error at the moment, and I'm unsure why.
Here's the code:
Dim varSearchArray As Variant
Dim strWhereSQL As String
Dim itm As Variant
'split out the text entered in the search bar
varSearchArray = Split(DescSearch, " ")
'add each word to the where clause of the query
For Each itm In varSearchArray
strWhereSQL = strWhereSQL & " OR (((tlkpMediaCode.Desc)='" &
varSearchArray(itm) & "'))"
Next
strSearchSQL = Right(strWhereSQL, Len(strWhereSQL) - 4) & ";"