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 / Mailmerge and Fax / August 2005

Tip: Looking for answers? Try searching our database.

How do I compare two dates in Word 2003?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Judith - 08 Aug 2005 15:42 GMT
I want to compare a MERGEFIELD date that has been extracted from an Access
database with a typed in value as part of an If...then...else statement. For
example, if the Date_Paid field is less than 01/01/2005 I want to insert text
to say that the person's membership has expired.

The syntax I came up with is
{IF {MERGEFIELD Date_Paid} < 01/01/2005 "This membership has expired" "This
membership is current"}
but it doesn't work. I have also tried adding a date pattern of \@
dd/MM\yyyy, and using quotes around the coparison date.

I am using Word 2003.
Signature

Judith

Doug Robbins - 08 Aug 2005 20:17 GMT
I would do the manipulation of the data with a query in Access.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

>I want to compare a MERGEFIELD date that has been extracted from an Access
> database with a typed in value as part of an If...then...else statement.
[quoted text clipped - 11 lines]
>
> I am using Word 2003.
Judith - 08 Aug 2005 21:12 GMT
I'm not exactly sure what you mean as I'm not very experienced with Access.
Are you indicating that Word can't actually compare dates? I have today tried
using the COMPARE function, but that seems to work only with strings and
numbers and the Help doesn't mention dates.
Signature

Judith

> I would do the manipulation of the data with a query in Access.
>
[quoted text clipped - 13 lines]
> >
> > I am using Word 2003.
Doug Robbins - 09 Aug 2005 04:55 GMT
You might find something on comparing dates in Word at:

http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902

I think though that in Word, you will find it necessary to use a number of
nested If...then...else statements that separately compare the day, the
month and the year, whereas in Access, in a query you simply use

IIF([Date_Paid] < #01/01/2005#, "This membership has expired", "This
membership is current")

Learn to use the power of Access.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> I'm not exactly sure what you mean as I'm not very experienced with
> Access.
[quoted text clipped - 23 lines]
>> >
>> > I am using Word 2003.
Judith - 09 Aug 2005 08:39 GMT
Thanks Doug. I will follow up both of these suggestions and let you know how
I get on.
Signature

Judith

> You might find something on comparing dates in Word at:
>
[quoted text clipped - 36 lines]
> >> >
> >> > I am using Word 2003.
Graham Mayor - 09 Aug 2005 06:26 GMT
{IF {MERGEFIELD Date_Paid \@ "yyyyMMdd"} <  20050101 "This membership has
expired"
"This membership is current"}

should do the trick - see http://www.gmayor.com/formatting_word_fields.htm

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

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

> I want to compare a MERGEFIELD date that has been extracted from an
> Access database with a typed in value as part of an If...then...else
[quoted text clipped - 9 lines]
>
> I am using Word 2003.
Judith - 09 Aug 2005 08:40 GMT
Thanks Graham - I will try this out as well as Doug's suggestions.
Signature

Judith

> {IF {MERGEFIELD Date_Paid \@ "yyyyMMdd"} <  20050101 "This membership has
> expired"
[quoted text clipped - 15 lines]
> >
> > I am using Word 2003.
Judith - 09 Aug 2005 09:57 GMT
Brilliant - it works exactly how I wanted it to (once I had remembered that I
needed to do MM rather than mm for the month!) Thanks a lot for the
suggestion.
Signature

Judith

> {IF {MERGEFIELD Date_Paid \@ "yyyyMMdd"} <  20050101 "This membership has
> expired"
[quoted text clipped - 15 lines]
> >
> > I am using Word 2003.
 
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.