Validation with an agent using Len to validate a field length

I have an agent I am using to validate many fields. I am suppliying 2 examples below. Every fields works as expected with the exception of CHASSISVIN where I am trying to ensure 17 characters are entered. No matter how many characters are in the field it still display the messagebox. Can someone please assist me with what I am doing wrong? Thanks in advance.

Elseif (source.fieldGetText (“ChassisModel”) = “”) And (source.fieldGetText (“UnitType”) <> “Other”) Then

		Messagebox ("Chassis Model is a required field.")

		Call source.GoToField ("ChassisModel")

		continue = False     

		Exit Sub



	Elseif (source.fieldGetText ("ChassisVIN") <> Len17) And	source.fieldGetText ("UnitType") <> "Other" Then			

		Messagebox ("Chassis VIN must be 17 characters.")

		Call source.GoToField ("ChassisVIN")

		continue = False     

		Exit Sub

Subject: Validation with an agent using Len to validate a field length

Umm what is Len17?? Is this a notes script “trick” I’m not familiar with?

How about changing it to

Len( source.fieldGetText (“ChassisVIN”) ) <> 17

Subject: Validation with an agent using Len to validate a field length

Try something like this instead…

Elseif (Len(source.fieldGetText (“ChassisVIN”)) <> 17) And source.fieldGetText (“UnitType”) <> “Other” Then

Messagebox (“Chassis VIN must be 17 characters.”)

Call source.GoToField (“ChassisVIN”)

continue = False

Exit Sub

Subject: RE: Validation with an agent using Len to validate a field length

Thank you and Thank you again. That seems so obvious to me NOW. I guess I spent too much time just knowing I had the code right :slight_smile: