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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word merge date between two dates 1

Status
Not open for further replies.

cjashwell

MIS
Jul 10, 2001
80
GB
Hi there. Does anyone know how to use Word fields to evaluate a date passed from a mailmerge field to see if it falls between two dates?

For example, if I want to know whether 10th September 2007 is between 1st September 2007 and 15th September 2007, how do I do this?

Assuming the Date merge field contains the 10th September 2007 (in some format), I would have thought that this would work:

Code:
{IF {=AND({MERGEFIELD Date}> 01092007, {MERGEFIELD Date}<15092007)}=1, "Between" "Not Between"}

But it doesn't. I'm using Word 2002. Does anyone have any suggestions? Thanks in advance.
 
Hi cjashwell ,

Try:
Code:
{IF{=({MERGEFIELD Date\@ YYYYMMDD} > 20070901)*({MERGEFIELD Date\@ YYYYMMDD} < 20070915)}= 1 True False}

Cheers

[MS MVP - Word]
 
Great - that does seem to work. Thank you very much indeed.

Can you tell me where this is documented, as I searched offline and online Help quite extensively but didn't find any references to this technique?
 
Thanks for your help macropod, and for linking to that very valuable resource. Best wishes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top