Force Entry in Text Field

J

Jamie

I am working in Word 2002. I have a check box (check1), that if checked the
user must complete text1.

I would like to have an OnExit macro, so when the user tabs out of text1,
and check1 is checked, a message will appear stating "You must complete this
field."

I'm not sure how to go about doing this, any help is appreciated.

Thanks,
 
J

Jay Freedman

I am working in Word 2002. I have a check box (check1), that if checked the
user must complete text1.

I would like to have an OnExit macro, so when the user tabs out of text1,
and check1 is checked, a message will appear stating "You must complete this
field."

I'm not sure how to go about doing this, any help is appreciated.

Thanks,

The basic idea is explained at
http://www.word.mvps.org/FAQs/TblsFldsFms/ValidateFFields.htm. The
specific test in the example macro won't do, of course. The code you
need looks something like this:

Sub ExitText1()
With ActiveDocument.FormFields("Text1")
If Len(.Result) = 0 And _
ActiveDocument.FormFields("Check1") _
.CheckBox.Value = True Then
Application.OnTime _
When:=Now + TimeValue("00:00:01"), _
Name:="GoBacktoText1"
MsgBox "You must complete this field"
End If
End With
End Sub

Sub GoBacktoText1()
ActiveDocument.Bookmarks("Text1").Range _
.Fields(1).Result.Select
End Sub
 

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