• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 265
  • Last Modified:

Logic to suppress text if a bookmark is null in Word 2007 template

I have a word 2007 template and on it I print a bookmark field called Line custom form field 4 which is a contract number.  I have included text “Contract #:” which precedes the bookmark.
          i.e.: (Contract #:  bookmark)
The problem is there is not always a contract number but the text “Contract #:” still prints out with nothing to the right of it.
Is there a way to suppress the text if the bookmark is null?
I tried an if statement that I found online (microsofts website) but all it did was print out my entire statement as text.  
          {If {Line custom form field 4} = “” “” “Contract# :”}
I’m sure the syntax is wrong but can’t seem to find anything on how to do this.
  • 3
1 Solution
Helen FeddemaCommented:
In the code that creates a new document from the template, look at the Contract # value, and if it is Null or empty, delete that line from the document.
debobrienAuthor Commented:
Where is that code?  These templates are created through an ERP software package's document printing function. When I create a document, I just tell it I want to use Word options and it creates a blank template and provides the bookmarks for all the available db fields I can use on the template.  (See attached).

I was hoping I could code something right on or within the template like I can with an Access form.
debobrienAuthor Commented:
Since I cannot change any code from the software vendor which creates the template, the software vendor has offered a solution to include the data in a separate table in the template.
debobrienAuthor Commented:
A usable solution was not offered here.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now