|
-
multiple keyword search to display to data grid control
I am currently working on a project that involves using a multiple keyword
search of an access database. The search result is supposed to display to
a data grid. Right now, the code that i have will:
1. Accept the mulitiple keywords from a text box
2. Separate the keywords into an array
3. search each keyword in with an sql statement through a loop
When it comes to the output, the data grid only displays the result of the
last word in the the keyword search text box.
Here is my code:
**************************************************************
Private Sub cmdKeyWordSearch_Click()
Dim strKeyWord As String
Dim SplitKeyWord() As String
Dim x As Integer
x = 0
strKeyWord = " " + txtKeyWord.Text
SplitKeyWord = Split(strKeyWord)
Do Until x = UBound(SplitKeyWord) + 1
SplitKeyWord(x) = "%" & SplitKeyWord(x) & "%"
adoClients.RecordSource = "SELECT * FROM ClientAddresses " & _
"WHERE Company LIKE" & Chr(34) & SplitKeyWord(x) & Chr(34)
adoClients.Refresh
dgrdClients.Visible = True
x = x + 1
loop
End Sub
**************************************************************
I need the data grid to display all the addresses where the company has any
of the keywords in it.
Thank you in advance for the response :-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks