Is this performed from the OnLayoutKeystroke Trigger?
If so try putting: ExitScript [false] just above the EndIf. This will keep the last character pressed from being entered into the field when it exceeds the character count.
Have you tried setting the Maximum Characters validation option in Field options instead?
I don't understand why there is an issue with spaces. The Length function counts all characters in the field--including space characters.
Ok, maybe I miss counted. If you say that length counts spaces then I'll certainly take your word for it.
The trigger is on the field itself on keystroke and I tried first with keystroke then went to validation but found it was only when I committed the record that validation would occur. I'd rather have it stop the second the character limit is reached. I will add the exit script and see what happens.
Works exactly how I wanted it to, thank you Phil.
Can you please explain to me what exactly ExitScript [False] does and why you I have to put [False]?
You've made me add that to other scripts before and I've yet to arrive at a logical conclusion.
Look up:Setting up script triggersIn Filemaker Help and read the notes at the very bottom.