Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #14  
Old 04-07-2013, 04:37 PM
macropod's Avatar
macropod macropod is offline Problems With MergeField Switches Windows 7 64bit Problems With MergeField Switches Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Hi Jennex,
Quote:
not needing seconds in my field, can I get away with simply removing the references to the seconds?
You could probably reduce the field code to:
{QUOTE
{SET ss{=ROUND({MERGEFIELD Time}*86400,0) \# 0}}
{SET hr{=INT(ss/3600)}}
{SET mn{=INT((ss-hr*3600)/60)}}
{QUOTE"{=IF(hr=0,12,hr)}:{mn}" \@ "h:mm "}{IF{=hr}< 12 a.m. p.m.}}

FWIW, the macro in the link you referred to is one I wrote.
Quote:
what would I have to do to the SQL statement code to allow different recipients. (type and SubResp)
I'm not sure what you're driving at there. If you want to filter the output, so only a predefined set of records is generated, you have two options:
1. Insert a SKIPIF field into the mailmerge main document, so the unwanted records are filtered out; or
2. Modify the SQL statement.
The former is easier for end-users to work with and could be coded like:
{SKIPIF{MERGEFIELD CONTRACT}<> {FILLIN "Contract to include." \o}}
or:
{SKIPIF{MERGEFIELD CONTRACT}= {FILLIN "Contract to exclude." \o}}
or even:
{SKIPIF{IF{FILLIN "Contract to include/exclude." \o }={MERGEFIELD CONTRACT} 0 1}= {FILLIN "1: include. 0: exclude." \o}}
If you'd prefer to do the filtering via the SQL, though, you'd need to hand-code that part, along the lines of the 'where 'Type$'='FR' And 'SubResp'='WPL1' ' in the code in your post. The 'ORDER BY' portion is simply the SQL equivalent of the sort order you'd apply in Word, though even this isn't needed if the data are sorted that way in the data source.

Regarding your remaining issues:
1. You can overcome the header mergefield issue via the use of SET fields in the body and REF fields in the header. See attached (I've made a variety of changes to the header and the first row of the table in the body). I haven't included the field code for the time manipulations as the document works fine for me without it.
2. Try the attached document - if it works, this ceases to be an issue; if not, we can come back to it.
3. Does the SKIPIF approach above (but with your 'Type' or 'SubResp') do as you need? If you need to be able to use both, I can code a field for that, too.
Attached Files
File Type: docx DR-HPL8.docx (380.4 KB, 16 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Switches ilovemypuppy Word 2 02-08-2012 04:28 PM
Problems With MergeField Switches Index switches cksm4 Word VBA 2 02-03-2011 07:21 AM
Mail merge switches Jan Collier Mail Merge 0 08-29-2010 06:06 AM
Command Line Switches Ringmaster Office 0 08-10-2010 06:27 AM
Help with switches: Word mail merge with Excel ks_ Mail Merge 0 12-09-2009 05:09 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:10 PM.


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