Reply
 
Thread Tools Display Modes
  #1   Report Post  
Michael M via OfficeKB.com
 
Posts: n/a
Default Form - required field(s) valid date

Hello,

I've created a form and need to make the first field (Text15) require that
the user enter a valid date, without bypassing it or leaving it blank.

I have modified the properties of the text box so that it's type is Date and
set it's Date Format, however in testing I have found that if the user does
not enter anything in the field, there is no way to require a valid date be
entered, that is only if I enter text or something else invalid.

Thank you,
Michael
  #2   Report Post  
Suzanne S. Barnhill
 
Posts: n/a
Default

See http://word.mvps.org/FAQs/TblsFldsFm...ateFFields.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Michael M via OfficeKB.com" wrote in message
...
Hello,

I've created a form and need to make the first field (Text15) require that
the user enter a valid date, without bypassing it or leaving it blank.

I have modified the properties of the text box so that it's type is Date

and
set it's Date Format, however in testing I have found that if the user

does
not enter anything in the field, there is no way to require a valid date

be
entered, that is only if I enter text or something else invalid.

Thank you,
Michael


  #3   Report Post  
Jay Freedman
 
Posts: n/a
Default

Michael M via OfficeKB.com wrote:
Hello,

I've created a form and need to make the first field (Text15) require
that the user enter a valid date, without bypassing it or leaving it
blank.

I have modified the properties of the text box so that it's type is
Date and set it's Date Format, however in testing I have found that
if the user does not enter anything in the field, there is no way to
require a valid date be entered, that is only if I enter text or
something else invalid.

Thank you,
Michael


See http://word.mvps.org/FAQs/TblsFldsFm...ateFFields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org


  #4   Report Post  
Michael M via OfficeKB.com
 
Posts: n/a
Default

Suzanne,

Thank you for the link, I did actually find that earlier and have attempted
to use that macro, but it does not work for me?

I see no change when I enter the form or the field, I am using Word XP. How
should I be entering this as a new macro, from the Tools Macros Macros
Create and I pasted this;

Sub ExitText2()
With ActiveDocument.FormFields("Text2")
If Len(.Result) 0 And Left$(.Result, 3) "KLM" Then
Application.OnTime When:=Now + TimeValue("00:00:01"), Name:
="GoBacktoText2"
MsgBox "The first three letters must be 'KLM'"
End If
End With
End Sub

Sub GoBacktoText2()
ActiveDocument.Bookmarks("Text2").Range.Fields(1). Result.Select
End Sub

Modifying it for my field "Text15" but it does not do anything? I notice no
change at all ... should this be selected as the "entry" or "exit" macro?

Thank you,
Michael

Suzanne S. Barnhill wrote:
See http://word.mvps.org/FAQs/TblsFldsFm...ateFFields.htm

Hello,

[quoted text clipped - 8 lines]
Thank you,
Michael



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...neral/200508/1
  #5   Report Post  
Jay Freedman
 
Posts: n/a
Default

Hi Michael,

Item 1: Select this macro as the exit macro for your field.

Item 2: Make sure you change "Text2" to "Text15" in all five places where it
occurs.

Item 3: You need to change the "If" statement (the third line of the
ExitText2 macro). The macro as you copied it from the web page is only an
example of the kind of thing you can do, and this particular example is
checking to be sure the field contents start with the letters KLM -- not
what you want. To check that the field is not empty, that line should be
replaced by

If Len(.Result) = 0 Then

You'll also want to change the message in the MsgBox statement to something
like "The date field cannot be blank".

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org

Michael M via OfficeKB.com wrote:
Suzanne,

Thank you for the link, I did actually find that earlier and have
attempted to use that macro, but it does not work for me?

I see no change when I enter the form or the field, I am using Word
XP. How should I be entering this as a new macro, from the Tools
Macros Macros Create and I pasted this;

Sub ExitText2()
With ActiveDocument.FormFields("Text2")
If Len(.Result) 0 And Left$(.Result, 3) "KLM" Then
Application.OnTime When:=Now + TimeValue("00:00:01"),
Name: ="GoBacktoText2"
MsgBox "The first three letters must be 'KLM'"
End If
End With
End Sub

Sub GoBacktoText2()
ActiveDocument.Bookmarks("Text2").Range.Fields(1). Result.Select
End Sub

Modifying it for my field "Text15" but it does not do anything? I
notice no change at all ... should this be selected as the "entry" or
"exit" macro?

Thank you,
Michael

Suzanne S. Barnhill wrote:
See http://word.mvps.org/FAQs/TblsFldsFm...ateFFields.htm

Hello,

[quoted text clipped - 8 lines]
Thank you,
Michael





  #6   Report Post  
Michael M via OfficeKB.com
 
Posts: n/a
Default

Thank you! That works beautifully, and I have made slight additions/changes
to it.

Thanks again!


Jay Freedman wrote:
Hi Michael,

Item 1: Select this macro as the exit macro for your field.

Item 2: Make sure you change "Text2" to "Text15" in all five places where it
occurs.

Item 3: You need to change the "If" statement (the third line of the
ExitText2 macro). The macro as you copied it from the web page is only an
example of the kind of thing you can do, and this particular example is
checking to be sure the field contents start with the letters KLM -- not
what you want. To check that the field is not empty, that line should be
replaced by

If Len(.Result) = 0 Then

You'll also want to change the message in the MsgBox statement to something
like "The date field cannot be blank".

Suzanne,

[quoted text clipped - 33 lines]
Thank you,
Michael



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...neral/200508/1
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Blank return for drop-down form fields Peter B. Microsoft Word Help 4 January 26th 07 05:01 PM
Pop-up on 'save' about required form fields Emily Sue Tables 4 November 10th 06 08:44 PM
How to keep date issued (not created) on protected form? Seagull Microsoft Word Help 2 June 24th 05 09:57 PM
How do I use a form then mailmerge without losing the form fields Someone who's stuck Mailmerge 1 June 23rd 05 10:01 AM
Having multiple form fields automatically updated jrwaguespack Microsoft Word Help 3 March 25th 05 07:43 AM


All times are GMT +1. The time now is 04:49 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"