View Single Post
  #2   Report Post  
Posted to microsoft.public.word.tables
Jay Freedman
 
Posts: n/a
Default If statement with dates

Hi Ryan,

What does the program insert if the date in the database is empty? Is it an
empty bookmark? If so, the field you need is this:

{ IF {imported_date} "" {imported_date} "N/A"}

To get the braces around the bookmark name nested inside the IF field, you
MUST use Ctrl+F9 -- you can't just type the braces on the keyboard.

What this says is:

- Evaluate the content of the bookmark named imported_date.
- If that content is not an empty string (represented by ""), then show the
content of the bookmark.
- If that content is an empty string, then show the string "N/A".

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

word wrote:
I have tried various iterations and have not been able to find a
solution.

We use a program to insert bookmarks into word from an SQL server.
One of the fields is a date and it is either a date or an empty
field. I am trying to get the date to display if there is one and an
"N/A" if there is not.

I have tried the following

{ =if imported_date 0 imported_date N/A}

I've tried it with { } around the bookmarks and " " and all sorts of
switches. I even tried converting the date to a different format
yyyyMMdd and comparing it.

Please somebody help.

Thanks,

Ryan