Question:
How can I keep the user from typing special characters in a setpoint ?
Solution:
To do so, you must add the following script to Setpoint’s Validate event:
N = Len(NewValue) ‘Returns to N the number of characters in the word
For i=1 to N ‘Loops until N’s value
Letter = Asc(Mid(NewValue, i, 1)) ‘Turns the letter selected by Mid into an ASCII value
If (Letter>=65 AND Letter <=90) OR (Letter >=97 AND Letter <=122) OR (Letter>=48 AND Letter <=57) Then
Else
MsgBox “ERROR in character: ” & i & ” Letter: ” & Chr(Letter)
End if
Next
For i=1 to N ‘Loops until N’s value
Letter = Asc(Mid(NewValue, i, 1)) ‘Turns the letter selected by Mid into an ASCII value
If (Letter>=65 AND Letter <=90) OR (Letter >=97 AND Letter <=122) OR (Letter>=48 AND Letter <=57) Then
Else
MsgBox “ERROR in character: ” & i & ” Letter: ” & Chr(Letter)
End if
Next
For further information, please refer to VBScript’s reference guide, as well as the application below.