Validate characters

HiI will use this to check if they use more then 5 characters, its work great. But if they use less then 5 characters i get no warning. How will i do that. Empty characters in the fied is OK.


Sub Exiting(Source As Field)

Dim currentchars As Integer

Dim maxchars As Integer

maxchars = 5

Dim curvalue As String



Dim wrkspc As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = wrkspc.CurrentDocument

curvalue = uidoc.FieldGetText("TitleHeader")

currentchars = Len(curvalue)

If(uidoc.EditMode = True) Then

	If(currentchars > maxchars) Then

		Msgbox "You have entered " & Cstr(currentchars) & " characters, but this field < Title > has a recommended limit of " & Cstr(maxchars) & " characters.",0+48,"Exceding Recommend Characters"

		Call uidoc.GotoField("Other")

	End If 

End If

End Sub


Kind regards

Leon

Subject: Validate characters

You only check " If(currentchars > maxchars) Then", so you should add a test to check for less than maxchars. Or you could combine it into a single test: “If(currentchars <> maxchars) Then” and modify your error message accordingly.