Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2008

Tip: Looking for answers? Try searching our database.

Form Validation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JonesP - 21 Jan 2008 01:42 GMT
I need to create a Word form that will restrict text fields to allow letters
only; and numeric fields to allow numbers only.  I'm using Word 2003.  Thanks.
Jay Freedman - 21 Jan 2008 02:17 GMT
>I need to create a Word form that will restrict text fields to allow letters
>only; and numeric fields to allow numbers only.  I'm using Word 2003.  Thanks.

See http://www.word.mvps.org/FAQs/TblsFldsFms/ValidateFFields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
JonesP - 23 Jan 2008 00:13 GMT
Yeah, I saw this but it wasn't very helpful.  Thanks anyway.

> >I need to create a Word form that will restrict text fields to allow letters
> >only; and numeric fields to allow numbers only.  I'm using Word 2003.  Thanks.
[quoted text clipped - 6 lines]
> Microsoft Word MVP        FAQ: http://word.mvps.org
> Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
Jay Freedman - 23 Jan 2008 16:21 GMT
Whether it's helpful depends on what behavior you're looking for. If you
want to prevent the "wrong" characters from even being typed into the field,
then form fields are the wrong tool because they can't do it. All they can
do is let you examine the user's entry when they try to leave the field.

To get more control over what can be typed in a field, you have to change to
using a UserForm (a custom dialog). The text entry box on a UserForm has a
Change event that fires every time the text in the box changes. You can
write a procedure to catch that event and look at the character that was
just typed; if it isn't valid for that box, the code can reject the
character, and it looks to the user as if the key is 'dead'.

To get a quick introduction to UserForms, see
http://www.word.mvps.org/FAQs/Userforms/CreateAUserForm.htm.

Signature

Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

> Yeah, I saw this but it wasn't very helpful.  Thanks anyway.
>
[quoted text clipped - 14 lines]
>> Email cannot be acknowledged; please post all follow-ups to the
>> newsgroup so all may benefit.
JonesP - 23 Jan 2008 16:35 GMT
OK, I'll check this out.  Thanks!

> Whether it's helpful depends on what behavior you're looking for. If you
> want to prevent the "wrong" characters from even being typed into the field,
[quoted text clipped - 29 lines]
> >> Email cannot be acknowledged; please post all follow-ups to the
> >> newsgroup so all may benefit.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.