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 / July 2005

Tip: Looking for answers? Try searching our database.

Using IF...Then when merging dates from Access to Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ecofreak - 26 Jul 2005 15:36 GMT
I am trying to create a document that brings a date from Access to Word.  
Problem is, I want all dates prior to a set date to register as one date and
all others to register as the date in the database.  I created the following
expression in Word
{IF{MERGEFIELD Anniversary}>6/21/2004 {Mergefield Anniversary\@"MMMM
d,yyyy"} "June 21, 2004"}.  But the only output I get, regardless of the
Anniversary date is the Anniversary date.  Is there a way to write this
expression that will give me the answer I want?  (Either in Word or in an
Access Query?)  BTW using Office 2000.
Peter Jamieson - 26 Jul 2005 18:52 GMT
The comparison operators >, < and so on do not work with dates - to get
numbers that can be compared in a useful way, try

{ IF{MERGEFIELD Anniversary \@YYYYMMDD } > 20042106
"{Mergefield Anniversary \@"MMMM d,yyyy"}" "June 21, 2004"}

Also,  please note that there should be spaces around the ">", it's
advisable to put quotes round both results (as shown) and all the {} need to
be the special field codes you can insert using cttrl-F9

Peter Jamieson

>I am trying to create a document that brings a date from Access to Word.
> Problem is, I want all dates prior to a set date to register as one date
[quoted text clipped - 7 lines]
> expression that will give me the answer I want?  (Either in Word or in an
> Access Query?)  BTW using Office 2000.
Doug Robbins - 26 Jul 2005 21:32 GMT
It's also better to do the manipulation with a query in Access.  After all,
it is a database and Word is a word processor.

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 am trying to create a document that brings a date from Access to Word.
> Problem is, I want all dates prior to a set date to register as one date
[quoted text clipped - 7 lines]
> expression that will give me the answer I want?  (Either in Word or in an
> Access Query?)  BTW using Office 2000.
Ecofreak - 26 Jul 2005 22:47 GMT
I tried creating an IIF expression in a query:
IIF([Anniversary] > 06/21/2004, [Anniversary], "June 21, 2004")  but all I
get is an error message.  I'm not at work right now, so I can't tell you
precisely what it says.  Something to the effect that it doesn't recognize it
as an If statement.

How does one go about creating an expression to do what I want?

> It's also better to do the manipulation with a query in Access.  After all,
> it is a database and Word is a word processor.
[quoted text clipped - 10 lines]
> > expression that will give me the answer I want?  (Either in Word or in an
> > Access Query?)  BTW using Office 2000.
Doug Robbins - 27 Jul 2005 04:39 GMT
The date needs to be enclosed inside ##

IIF([Anniversary] > #06/21/2004#, [Anniversary], "June 21, 2004")

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 tried creating an IIF expression in a query:
> IIF([Anniversary] > 06/21/2004, [Anniversary], "June 21, 2004")  but all I
[quoted text clipped - 23 lines]
>> > an
>> > Access Query?)  BTW using Office 2000.
Graham Mayor - 27 Jul 2005 07:35 GMT
You must use the correct syntax - see Peter's example. The field boundaries
are inserted with CTRL+F9
See also 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 tried creating an IIF expression in a query:
> IIF([Anniversary] > 06/21/2004, [Anniversary], "June 21, 2004")  but
[quoted text clipped - 25 lines]
>>> write this expression that will give me the answer I want?  (Either
>>> in Word or in an Access Query?)  BTW using Office 2000.
Ecofreak - 27 Jul 2005 12:56 GMT
Thanks to both Doug and Peter.  I was able to create the statement I needed
in both Word and Access.  This will definitely prove helpful in the future.

> I am trying to create a document that brings a date from Access to Word.  
> Problem is, I want all dates prior to a set date to register as one date and
[quoted text clipped - 5 lines]
> expression that will give me the answer I want?  (Either in Word or in an
> Access Query?)  BTW using Office 2000.
 
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.