Minimum length in Text Form Field Options?

A

ArcticWolf

Hi,

Setting the manimum is simple enough but is there a way to set a minimum
length please?

TIA,

AW
 
J

Jay Freedman

ArcticWolf said:
Hi,

Setting the manimum is simple enough but is there a way to set a
minimum length please?

TIA,

AW

It's not clear to me whether you want to set the starting width of the
unfilled field (by default it's five nonbreaking spaces, but you can set the
default text to more by typing Ctrl+Shift+space characters in the Properties
dialog), or whether you want to check the user's entry to be sure it's at
least a minimum number of characters.

If it's the latter, see http://www.gmayor.com/formfieldmacros.htm. The
modification you need is in the AOnExit() procedure: change the line

If Len(.Result) = 0 Then

by replacing the = 0 with < n where n is the minimum number of characters.
For instance, to require at least 5 characters, make the line

If Len(.Result) < 5 Then

You'll also want to change the message on the following line.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
A

ArcticWolf

Thanks for the prompt response Jay, it was the latter! It's also given me a
couple of extra ideas so thanks for the heads-up :)

ATB,

AW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top