Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WORD text form fields

Status
Not open for further replies.

jayjay66

Technical User
Oct 31, 2005
114
Hi,

I would need some because what I'm trying doesn't seem to work.

I've created a simple WORD document and I used "Forms" to create a text form field. The properties of the text form are as follows:

Type="Number"
Maximum length=10

yet I can still enter letters in that darn field. What am i doing wrong? I would to be able to enter only numbers.

Please help.

Thanks,
JJ
 
Unfortunatately, the text stay there. The text field I'm trying to create is a phone # field with area code.

Example, the phone # is: 613-123-4567, I want the field to be

6131234567

I don't want the user to be able to enter letters or dashes.

Thanks,
JJ


 
Well, I just tried it and it works for me using Word 2003(I get a nasty message that a valid number is required).

What version of Word?

Are you remembering to lock the form fields?



 
Word-2000

How do I lock the form fields??
 
On the forms toolbar is a button that looks like a lock. The screen tip might say 'Protect form'.

 
Lilliabeth, I don't have 2003, so I am curious...what happens when you have your Number text formfield, and you enter 123sdfgt45?

Gerry
 
Hmmm...

In both 2000 and 2003 I get the same behaviour. Non-numeric characters are removed, without any error, when I exit the field. It also truncates decimal points and all following digits.

Seems fairly useless to me. I would code an exit macro.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
If I enter 123sdfgt45, it removes the alpha characters and does not error.

But...

If I enter 931-555-1234, I get the message " A Valid Number is Required" and I am unable to tab out of the field.

 
[smile] Yes, the minus signs are the only non-numeric characters the field will accept and more than one of them seems to be the only thing which triggers an error message.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
That was my point. The checks on the values are IMHO sort of useless - as Tony noted. I also agree that to really do it, an OnExit macro is far better. If the final result has real requirements it seems to me that your own error checking is more appropriate.

Gerry
 
Yeah. I pasted 123sdfgt45 and hit enter and got 123t45 and no error (tho I didn't assign one). Weird that others get something different. If I directly type 123t45 it leaves the t, but if I type 123jjj45, it leaves only 123.

Excel VBA Certification is Finally Here!
Check out this bar:
 

thanks for all your help guys, it's working perfectly. :)
 
Hmmmmm, I wonder if it works "perfectly" if a user enters real gibberish......
Yeah. I pasted 123sdfgt45 and hit enter and got 123t45 and no error (tho I didn't assign one). Weird that others get something different. If I directly type 123t45 it leaves the t, but if I type 123jjj45, it leaves only 123.
Say WHAAAT???? That is even more bizarre. Shudder. Yeah, things can sort of work OK if the data entered is not too far gone, but there is NO substitute for proper (and explicit) error trapping.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top