Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using strings to determine results...

Status
Not open for further replies.

bitech

Programmer
May 19, 2001
63
0
0
US
I am having a hard time understanding how to get the system to search by more than one keyword in a textbox. I know it could be done in which the user types in:

Example:
computers, handheld, data


And it should return all companies that have the keywords,

"computers" or "handheld" or "data" in its keywords field.
 
you can try using a query and get the criteria from the form. Then in the Query itself add wild cards. Look under the Help files at WildCards.

HTH Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
If I could get the query to understand that the Or statement needs to be inserted in every occurence of a space or a comma
 
you could write a parser that searches for these characters then replaces them with the word or. I may have something like that started let me look. Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
Below is a function that will look for commas with a little modification you could have it look for other things also the when it finds the comma the function will replace it with the word OR. After that then you can use it in your query. If you need any help with it let me know.

'StringToChange would be the Text Field
'CharToChange would be the comma
'ReplaceWithChar would be the word OR

Function CharChange(StringToChange As String, CharToChange As String, Optional ReplaceWithChar As String)

Dim strCharString As String
Dim intCounter As Integer
Dim strCharCount As String
Dim strCountString As String
Dim intLoopControl As Integer

On Error GoTo HandleErr

intCounter = (Len(StringToChange))

For intLoopControl = 1 To intCounter

strCountString = Right$(StringToChange, intCounter)
strCharCount = Left$(strCountString, 1)

If (strCharCount <> CharToChange) Then
strCharString = strCharString & strCharCount
Else
If (ReplaceWithChar <> &quot;&quot;) Then
strCharString = strCharString & ReplaceWithChar
End If
End If
intCounter = intCounter - 1
Next intLoopControl

CharChange = strCharString

ExitHere:
Exit Function

HandleErr:
Select Case Err.Number
Case Else
MsgBox &quot;Error &quot; & Err.Number & &quot;: &quot; & Err.Description, vbCritical, &quot;Change_Case&quot;
End Select

End Function

HTH
Dave

Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
Maybe you can help me out....I know you pretty much wrote the code out there for me....but sometimes I don't know where to insert my stuff and where not to change the code...


The textbox I want it to retrieve the data from is called

keywords

the delimiter I want is

, {the comma sign}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top