Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
Jean D Jean D is offline
external usenet poster
 
Posts: 2
Default Form Field Date Comparison

In Word 2007, I have a form with fields. I have the user enter a date in
Field1 and then want Field2 to do certain things based on whether the date
in Field1 is greater than a static date. I read a great example from
Graham Mayor that works, but when I try to change the date format from the
example, it won't work.

Works:
Format Field1 as a yyyyMMdd date
Field2: =If (Field1 \@ "yyyyMMdd" 20080701, 1, 2)

This is great, but it makes Field1 show up as 20081210, when I would like
it to show up as 12/10/08.

Is there a way to do a date comparison and still have Field1 display a date
in the M/D/YY format?

Thanks for any help!
  #2   Report Post  
Posted to microsoft.public.word.newusers
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Form Field Date Comparison

Hi Jean,

You could leave Field1 in 'D M YYYY' format or 'M D YYYY' format (or whichever variant of those you prefer. You could then use a
formula field (not a formfield) to do the comparison using the following syntax:
{IF{Field1 \@ YYYYMMDD} 20080701 "1" "2"}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message.

--
Cheers
macropod
[MVP - Microsoft Word]


"Jean D" wrote in message ...
In Word 2007, I have a form with fields. I have the user enter a date in
Field1 and then want Field2 to do certain things based on whether the date
in Field1 is greater than a static date. I read a great example from
Graham Mayor that works, but when I try to change the date format from the
example, it won't work.

Works:
Format Field1 as a yyyyMMdd date
Field2: =If (Field1 \@ "yyyyMMdd" 20080701, 1, 2)

This is great, but it makes Field1 show up as 20081210, when I would like
it to show up as 12/10/08.

Is there a way to do a date comparison and still have Field1 display a date
in the M/D/YY format?

Thanks for any help!


  #3   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Form Field Date Comparison

I don't recall suggesting that you should format Field1 as yyyyMMdd? It is
in the conditional field where it needs to be so formatted. Field1 can use
any valid date format you require at the point of its display.
See http://www.gmayor.com/formatting_word_fields.htm
If thgis is a protected form and Field1 is a text form field with its
properties set as Date with the format M/d/yy (or d/M/yy) then the second
field should be a Word field combination (not a form field)
{ If { Field1 \@ "yyyyMMdd" } 20080701 1 2 }
or
{ If { Field1 \@ "yyyyMMdd" } 20080701 "1" "2" }


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Jean D wrote:
In Word 2007, I have a form with fields. I have the user enter a
date in Field1 and then want Field2 to do certain things based on
whether the date in Field1 is greater than a static date. I read a
great example from Graham Mayor that works, but when I try to change
the date format from the example, it won't work.

Works:
Format Field1 as a yyyyMMdd date
Field2: =If (Field1 \@ "yyyyMMdd" 20080701, 1, 2)

This is great, but it makes Field1 show up as 20081210, when I would
like it to show up as 12/10/08.

Is there a way to do a date comparison and still have Field1 display
a date in the M/D/YY format?

Thanks for any help!



  #4   Report Post  
Posted to microsoft.public.word.newusers
Jean D Jean D is offline
external usenet poster
 
Posts: 2
Default Form Field Date Comparison

Thank you both for your help! This works perfectly. I now see that I am
having a newbie confusion between calculated form fields and formula
fields. They seemed to have the same functionality, but now I am beginning
to see that they don't. I also realize now that this confustion caused me
to misread your (Graham) example that I found earlier. I'll see if I can
find any reference to help me understand when to use one or the other.

Thank you both again so much!

J.


On Thu, 11 Dec 2008 08:21:35 +0200, Graham Mayor wrote:

From: "Graham Mayor"
References:
Subject: Form Field Date Comparison
Date: Thu, 11 Dec 2008 08:21:35 +0200
Lines: 41
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
Message-ID:
Newsgroups: microsoft.public.word.newusers
NNTP-Posting-Host: 213-209-106.netrun.cytanet.com.cy 213.7.209.106
Path: news.qwest.net!mpls-num-01.inet.qwest.net!mpls-txt-01.inet.qwest.net!feed.news.qwest.net!mpls-nntp-02.inet.qwest.net!news.ecp.fr!feeder.erje.net!news feed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!TK2MSFTFEEDS02.phx.gbl!TK2MSFTNGP01.phx. gbl!TK2MSFTNGP04.phx.gbl
Xref: news.qwest.net microsoft.public.word.newusers:25570

I don't recall suggesting that you should format Field1 as yyyyMMdd? It is
in the conditional field where it needs to be so formatted. Field1 can use
any valid date format you require at the point of its display.
See http://www.gmayor.com/formatting_word_fields.htm
If thgis is a protected form and Field1 is a text form field with its
properties set as Date with the format M/d/yy (or d/M/yy) then the second
field should be a Word field combination (not a form field)
{ If { Field1 \@ "yyyyMMdd" } 20080701 1 2 }
or
{ If { Field1 \@ "yyyyMMdd" } 20080701 "1" "2" }

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
Form Field of Date Type Not Keeping Month Portion Of Date Ronald R. Dodge, Jr. Microsoft Word Help 1 October 20th 08 11:46 AM
Date field in form Fill-in Form General Questions Microsoft Word Help 1 April 30th 08 12:44 PM
Use current date in the default date form field option [email protected] Microsoft Word Help 4 April 8th 07 08:27 AM
I want a form field to figure a date based on the letter date. Virginia Native Microsoft Word Help 2 September 22nd 06 09:52 AM
Date comparison inconsistency Tosca Mailmerge 3 September 27th 05 08:42 AM


All times are GMT +1. The time now is 05:43 PM.

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"