Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
word
 
Posts: n/a
Default 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   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




  #3   Report Post  
Posted to microsoft.public.word.tables
word
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.word.tables
Tony Jollans
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.word.tables
word
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.word.tables
Tony Jollans
 
Posts: n/a
Default 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.



  #7   Report Post  
Posted to microsoft.public.word.tables
Suzanne S. Barnhill
 
Posts: n/a
Default If statement with dates

Perhaps the bookmark is actually "Contract_Date"?

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Tony Jollans" My Forename at My Surname dot com wrote in message
...
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.




  #8   Report Post  
Posted to microsoft.public.word.tables
word
 
Posts: n/a
Default If statement with dates

The bookmark is actually kf50e52e783c6487a96 but is actually being
inserted as Contract Date so that I know what it is. Once again, I
don't know how all of this works with the SQL server, but a program
called boomark assistant allows me to place these named bookmarks
throughout the document.

The search continues and I appreciate all the input.

Ryan

  #9   Report Post  
Posted to microsoft.public.word.tables
Tony Jollans
 
Posts: n/a
Default If statement with dates

If you're going to manually edit the results of another program you're going
to have to use whatever it generates. In this case it looks like you will
need ..

{ if {kf50e52e783c6487a96} "" {kf50e52e783c6487a96} "N/A" }

This may give you some maintainability problems - depending on how your
bookmark assistant works - I don't know.

--
Enjoy,
Tony


"word" wrote in message
oups.com...
The bookmark is actually kf50e52e783c6487a96 but is actually being
inserted as Contract Date so that I know what it is. Once again, I
don't know how all of this works with the SQL server, but a program
called boomark assistant allows me to place these named bookmarks
throughout the document.

The search continues and I appreciate all the input.

Ryan



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to merge dates into labels katwhit Mailmerge 1 December 23rd 05 03:06 PM
Windows explorer dates to match Word dates John Microsoft Word Help 0 October 17th 05 11:43 PM
Windows explorer dates to match Word dates John Microsoft Word Help 0 October 17th 05 11:30 PM
Windows explorer dates to match Word dates John Microsoft Word Help 1 October 17th 05 09:26 PM
Windows explorer dates to match Word dates John Microsoft Word Help 1 October 16th 05 10:18 PM


All times are GMT +1. The time now is 10:06 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"