Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-17-2016, 02:14 PM
sfkHooper sfkHooper is offline Displaying FORMTEXT fields when merge fields are empty or null Windows 7 64bit Displaying FORMTEXT fields when merge fields are empty or null Office 2013
Novice
Displaying FORMTEXT fields when merge fields are empty or null
 
Join Date: Jan 2016
Posts: 3
sfkHooper is on a distinguished road
Default Displaying FORMTEXT fields when merge fields are empty or null


I have a merge document (Word 2013) that I want to distribute to customers and have them fill in the missing information. The merge document populates fields from our database but where we have missing entries, in the mobile phone number for instance, I want a formtext field to display, prompting action from the customer to complete.

I have tried using an IF statement:
{ IF { MERGEFIELD "Mobile Phone" } = "" { FORMTEXT } { MERGEFIELD "Mobile Phone"} }

As you might expect, if "Mobile Phone" has data, then it is displayed. But if the field is empty, then nothing is displayed. Other formtext fields not embedded within merge fields display correctly.

How can I display the formtext field conditionally?
Reply With Quote
  #2  
Old 01-17-2016, 04:22 PM
macropod's Avatar
macropod macropod is offline Displaying FORMTEXT fields when merge fields are empty or null Windows 7 64bit Displaying FORMTEXT fields when merge fields are empty or null Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You can't use formfields in a mailmerge document - they get deleted when the merge executes. However, you could insert all your mergefields into Rich Text Content Controls. That way, without the need to IF tests, the Content Controls will display either the merge results or the standard Content Control prompt. Plus the users will be able to edit any data that needs updating. When the forms are returned, you could then programmatically capture the data from the content controls to update the data source.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-17-2016, 04:50 PM
sfkHooper sfkHooper is offline Displaying FORMTEXT fields when merge fields are empty or null Windows 7 64bit Displaying FORMTEXT fields when merge fields are empty or null Office 2013
Novice
Displaying FORMTEXT fields when merge fields are empty or null
 
Join Date: Jan 2016
Posts: 3
sfkHooper is on a distinguished road
Default

Hi Paul,

Thanks for your advice. This does sound like the way to go. Can you point me to a resource that illustrates how to link content controls to merge fields?

Thanks,
Reply With Quote
  #4  
Old 01-17-2016, 10:16 PM
macropod's Avatar
macropod macropod is offline Displaying FORMTEXT fields when merge fields are empty or null Windows 7 64bit Displaying FORMTEXT fields when merge fields are empty or null Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

No linking is required. Simply insert a Rich Text Content Control, then insert the mergefield into that.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 01-17-2016, 10:25 PM
gmayor's Avatar
gmayor gmayor is offline Displaying FORMTEXT fields when merge fields are empty or null Windows 10 Displaying FORMTEXT fields when merge fields are empty or null Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,103
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

http://www.gmayor.com/ManyToOne.htm will allow you to combine mail merge and protected form fields in the same document. Note that this is not a true merge and your data must be in Excel format.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #6  
Old 01-19-2016, 03:51 PM
sfkHooper sfkHooper is offline Displaying FORMTEXT fields when merge fields are empty or null Windows 7 64bit Displaying FORMTEXT fields when merge fields are empty or null Office 2013
Novice
Displaying FORMTEXT fields when merge fields are empty or null
 
Join Date: Jan 2016
Posts: 3
sfkHooper is on a distinguished road
Default Limited success

Hi,

I've had some limited success. I dropped a Rich Text Content Control into my document and then inserted a merge field into that. When I ran the merge the expected data was correctly populated. However I have a couple of issues.

Elsewhere on the document I have plain formtext fields that display with a grey background, offering a visual clue to the recipient that data is required. Is there a way that I can make the Rich Text Content Control appear that way, particularly if it's empty?

Also I noticed that when the document is protected with editing restrictions you can't fill in the RTCC like you can the formtext fields. Is there a workaround for that?

Thanks very much for your assistance so far.
Reply With Quote
  #7  
Old 01-19-2016, 04:24 PM
macropod's Avatar
macropod macropod is offline Displaying FORMTEXT fields when merge fields are empty or null Windows 7 64bit Displaying FORMTEXT fields when merge fields are empty or null Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Firstly, you shouldn't mix content controls and formfields in the same document. They were not designed to work together and can exhibit some strange behaviour at times if you do so. The problem you're having may be part of that. Amongst other things, you can't tab out of a Content Control into a formfield. In any event, you can't tab out of a Rich Text Content Control (because they accept tabs as input); you need to use the mouse to select another control. Aside from such peculiarities, you should be able to edit a Rich Text Content Control in a document with filling-in-forms editing restrictions.

A document with filling-in-forms editing restrictions cannot be used for a mailmerge - you would have to apply those restrictions post-merge. In any event, Content Controls don't require any form of editing restrictions - the most you might need to do is to set their 'cannot be deleted' property. If you need to have some kind of shading, you could apply the 'no changes (read only)' restrictions - to each content control - post merge (you'd probably want to use a macro for that).

If the Rich Text Content Control isn't populated by the mergefield, it will display its pale-grey default 'click here to enter text' prompt.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
merge formtext



Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying FORMTEXT fields when merge fields are empty or null Empty Fields in MS Word georgedy Word 1 12-21-2015 10:38 PM
Macro to keep formatted form fields after mail merge or replace text with formatted form fields jer85 Word VBA 2 04-05-2015 10:00 PM
Using fields to test on empty ? NobodysPerfect Word 4 10-11-2014 03:01 AM
Word 2010 - DOCX File with fields -> PDF with fields senglory Word 2 03-27-2012 10:10 AM
Displaying FORMTEXT fields when merge fields are empty or null Help with merge fields Chris182 Mail Merge 3 12-04-2011 07:39 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:49 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft