Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I want to compare a specific date with a date coming in via a MERGEFIELD.
I've set it up as {IF "12/12/2005" {MERGEFIELD DATE} "Static date is later" "Static date is earlier"}. What's happening is the opposite of what I expect. My MERGEFIELD DATE is 12/12/2004 and the field results are showing "Static date is earlier". If I change the static date to "12/12/03", I get "Static date is later". I suppose I could get around it by doing the opposite to what I think is logical, but I'd really like to understand what's going on. Can someone help please? |
#2
![]() |
|||
|
|||
![]()
There are two issues. First, the comparison Word is making is a *string*
comparison, not a date comparison. It's comparing the string "12/12/2005" with the date *representation* returned by your merging, which will depend on your regional settings. In other words, it can't work like this. Word can't directly do date arithmetic or comparisons in fields. The simplest method for your purposes is to modify the merge query to include the decision: SELECT IIF([DateField] #2005-12-12#, "Earlier", "Later") as DateStatus ..... Alternatively, you could run a macro on completion to update the display. Or for a third option, Macropod will probably suggest his/her wierd and wonderful field hacks. Bear in mind that these are indeed hacks, and M's furious imprecations notwithstanding, shouldn't be used for any serious purpose. "Marion G" Marion wrote in message ... I want to compare a specific date with a date coming in via a MERGEFIELD. I've set it up as {IF "12/12/2005" {MERGEFIELD DATE} "Static date is later" "Static date is earlier"}. What's happening is the opposite of what I expect. My MERGEFIELD DATE is 12/12/2004 and the field results are showing "Static date is earlier". If I change the static date to "12/12/03", I get "Static date is later". I suppose I could get around it by doing the opposite to what I think is logical, but I'd really like to understand what's going on. Can someone help please? |
#3
![]() |
|||
|
|||
![]()
See the relevant section at which demonstrates this using fields -
http://www.gmayor.com/formatting_word_fields.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Marion G wrote: I want to compare a specific date with a date coming in via a MERGEFIELD. I've set it up as {IF "12/12/2005" {MERGEFIELD DATE} "Static date is later" "Static date is earlier"}. What's happening is the opposite of what I expect. My MERGEFIELD DATE is 12/12/2004 and the field results are showing "Static date is earlier". If I change the static date to "12/12/03", I get "Static date is later". I suppose I could get around it by doing the opposite to what I think is logical, but I'd really like to understand what's going on. Can someone help please? |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I divide a page into three sections? | Microsoft Word Help | |||
saving the workspace | Microsoft Word Help | |||
How do I insert and format part of a data field in a Word document | Microsoft Word Help | |||
How does Word compare to its contemporaries? | Microsoft Word Help | |||
How do I make a word document insert consequative dates on each p. | Microsoft Word Help |