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!

Input Box checking SYNTAX

Status
Not open for further replies.

vtivti

Technical User
Mar 26, 2002
4
GB
I need to check the input of an input box to see if it contains a space, <, >, or $ and if it does to junk the string and start again. I have no idea how to even start on this one?

Any takers?

Thanks in advance

M-J - MCSE
 
something like...
Dim strtext,OK
strtext = &quot;&quot;
OK = False
While OK = False
strtext = InputBox(&quot;Enter String&quot;,&quot;Input&quot;)
If (Instr(0,strtext,&quot; &quot;,1) = 0) Then
If (Instr(0,strtext,&quot;<&quot;,1) = 0) Then
If (Instr(0,strtext,&quot;>&quot;,1) = 0) Then
If (Instr(0,strtext,&quot;$&quot;,1) = 0) Then
OK = True
End If
End If
End If
End If
Wend
 
Here's another method using Reg Expressions
Do
inputString = InputBox(&quot;Enter String to Check&quot;)
Dim re
Set re = New RegExp
re.Global = True
re.Pattern = &quot;[<>/$\s]&quot;
If re.Test(inputString) Then
strCheck = True
Else
Exit Do
End If
Loop While strCheck = True
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top