Limit Form Text Field

  • Thread starter Thread starter Greg
  • Start date Start date
G

Greg

Courtney,

Unprotect the form, double click the field and set maximum
character length to 500.

-----Original Message-----
Hi, I need help limiting a Form Text Field to a number
and that number needs to be no more than 500. I'm
thinking there is a way to set this up via the macro
option, but don't have a clue on how to do that. Can you
help? Thank you.
 
I want to limit the number they input to 500, not character spacing but the actual number 500. So, if they input any number between 1 - 500 it will insert it, but if they select 600 it won't let them add that number.
 
Hi Courtney

There's nothing in the form field's properties to let you check the value.
You'll need a macro, set as the form field's Exit macro, to do that.

The explanation and a sample are at
http://word.mvps.org/faqs/tblsfldsfms/ValidateFFields.htm. For your
purposes, replace the line in the sample code

If Len(.Result) > 0 And Left$(.Result, 3) <> "KLM" Then

with this:

If Len(.Result) > 0 And Val(.Result) > 500 Then

and adjust the name of the form field and the content of the error message
to match your needs.

Hint: You have to create the macro in the template first. Only then will you
be able to assign it as the Exit macro in the form field's Properties
dialog.
 
Back
Top