Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.tables
|
|||
|
|||
If statement with dates
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 |
#2
Posted to microsoft.public.word.tables
|
|||
|
|||
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 |
#3
Posted to microsoft.public.word.tables
|
|||
|
|||
If statement with dates
Thanks very much, but it does not work as you've typed it. The
bookmark is blank, but I get a syntax error still. It seems like it should work based on everything I have read. Here is what I have typed in (using Ctrl-F9 when needed) { if {Contract Date} "" {Contract Date} "N/A" } It gives me an undefined bookmark error. So I took out the braces and it doesn't give me an error, but is blank. The bookmark is empty when I see the contents with the brackets []. I would be happy to pay for consulting services if someone would tackle this issue for me. |
#4
Posted to microsoft.public.word.tables
|
|||
|
|||
If statement with dates
Bookmark names cannot have spaces in them so what is "Contract Date"?
-- Enjoy, Tony "word" wrote in message oups.com... Thanks very much, but it does not work as you've typed it. The bookmark is blank, but I get a syntax error still. It seems like it should work based on everything I have read. Here is what I have typed in (using Ctrl-F9 when needed) { if {Contract Date} "" {Contract Date} "N/A" } It gives me an undefined bookmark error. So I took out the braces and it doesn't give me an error, but is blank. The bookmark is empty when I see the contents with the brackets []. I would be happy to pay for consulting services if someone would tackle this issue for me. |
#5
Posted to microsoft.public.word.tables
|
|||
|
|||
If statement with dates
Well, the database program allows us to insert bookmarks into the word
documents using a customized bookmark assistant program. I don't know technically how they do it, just that it works like that. We go through a template document and place these bookmarks where we have dynamic information that needs to be populated. I've used bookmarks within the word tables for calculations, so I don't think it has anything to do with a space in the name. I'm as confused about this as anybody, seems like half the time my calcs work, half the time they don't. |
#6
Posted to microsoft.public.word.tables
|
|||
|
|||
If statement with dates
I suspect it's looking for a bookmark called "Contract" - and not finding
one. Can you look at your bookmarks under Insert Bookmarks and see what there is? -- Enjoy, Tony "word" wrote in message oups.com... Well, the database program allows us to insert bookmarks into the word documents using a customized bookmark assistant program. I don't know technically how they do it, just that it works like that. We go through a template document and place these bookmarks where we have dynamic information that needs to be populated. I've used bookmarks within the word tables for calculations, so I don't think it has anything to do with a space in the name. I'm as confused about this as anybody, seems like half the time my calcs work, half the time they don't. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to merge dates into labels | Mailmerge | |||
Windows explorer dates to match Word dates | Microsoft Word Help | |||
Windows explorer dates to match Word dates | Microsoft Word Help | |||
Windows explorer dates to match Word dates | Microsoft Word Help | |||
Windows explorer dates to match Word dates | Microsoft Word Help |