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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to search? 1

Status
Not open for further replies.

aida

MIS
Nov 1, 2001
2
IN
Hello....
My question is:
1. I have a text area in which the user will enter text. The text will be stored in a database (oracle). I want to create a function that can check the character the user enter. For example if the character is * then the character will be stored as ***** in database. The program then continue look at each character in the text and store it as above in the database.

How to do that?
Thank You
Aida
 
Dim sEntry
Dim sNewEntry
Dim lLenEntry
Dim i

sLenEntry = Len(sEntry)
For i = 1 To lLenEntry
If Mid(sEntry,i,1) = "*" Then
sNewEntry = sNewEntry & "*****"
Else
sNewEntry = sNewEntry & Mid(sEntry,i,1)
End If
Next


Then, write sNewEntry to the database, instead of sEntry.

Alternatively, you can use InStr to check for the existence of an * and use the loop

Dim lAsterixFound
lAsterixFound = InStr(sEntry,"*")
Do Until lAsterixFound = 0
' process the string using Left / Mid
lAsterixFound = InStr(lAsterixFound+1,sEntry,"*")
Loop


Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top