Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-06-2013, 01:10 PM
Tornado70 Tornado70 is offline Mail merge with filter using data inputted by user Windows 7 64bit Mail merge with filter using data inputted by user Office 2010 64bit
Novice
Mail merge with filter using data inputted by user
 
Join Date: Apr 2013
Posts: 4
Tornado70 is on a distinguished road
Default Mail merge with filter using data inputted by user

Hi,



I'm quite a novice when it comes to mail merge. I have a document set up (word 2003) that gets it's data using mail merge from an Excel spreadsheet.
The data required is determined by a 'date' field and a 'shift' field.

At present I can manually go to mailings/edit list/filter and set the required date and shift values. This works fine, but different people are going to be using this on a daily basis, so I would like to have a text box for 'date' and 'shift' in the main word document which the user can enter, and the filter will then run on these values. Explaining to each user how to edit the values in mailings/edit list/filter will no doubt cause problems.

Is this possible? Would appreciate some advice on how to set this up.
Reply With Quote
  #2  
Old 04-07-2013, 04:58 PM
macropod's Avatar
macropod macropod is offline Mail merge with filter using data inputted by user Windows 7 64bit Mail merge with filter using data inputted by user Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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 Tornado70,


Assuming you only want the output to reflect a nominated shift on a nominated dat, you could use a SKIPIF field, coded along the lines of:
{SKIPIF{={IF{MERGEFIELD MyDate \@ YYYYMMDD}={FILLIN "Date to include (in YYYYMMDD format, please)." \@ YYYYMMDD \o } 1 0}*{IF{MERGEFIELD Shift}={FILLIN "Shift to include." \o} 1 0}}= 0}

Note: The field brace pairs (ie '{ }') for the above example are created in the body of the document via Ctrl-F9 (Cmd-F9 on a Mac) - you can't simply type them or copy & paste them from this message.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 04-08-2013, 11:07 AM
Tornado70 Tornado70 is offline Mail merge with filter using data inputted by user Windows 7 64bit Mail merge with filter using data inputted by user Office 2010 64bit
Novice
Mail merge with filter using data inputted by user
 
Join Date: Apr 2013
Posts: 4
Tornado70 is on a distinguished road
Default

Thanks for the information, I had no idea where to start but this has helped. I can't quite get the code you gave to work correctly, it prompts for the date and shift but whatever I enter it still pulls in all records.

I have worked out from your code how to use the SKIPIF command to get records for today's date and a specified 'shift', which means using a separate document for each shift will give me what I need.

It would be nice to have the prompt working to give the option of printing other dates.

Just in case it helps, the date field is in UK format, ie DDMMYYYY and the shift field is either:
6-2 or 2-10

If there are any other suggestions it would be much appreciated.
Reply With Quote
  #4  
Old 04-08-2013, 03:15 PM
macropod's Avatar
macropod macropod is offline Mail merge with filter using data inputted by user Windows 7 64bit Mail merge with filter using data inputted by user Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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 Tornado70,

A 'date' in a DDMMYYYY format isn't a date - it's just an 8-digit number. To work with that, you'd need to change the field code to:
{SKIPIF{={IF{MERGEFIELD MyDate}={FILLIN "Date to include (in DDMMYYYY format, please)." \o} 1 0}*{IF{MERGEFIELD Shift}={FILLIN "Shift to include." \o} 1 0}}= 0}
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 04-08-2013, 08:24 PM
Tornado70 Tornado70 is offline Mail merge with filter using data inputted by user Windows 7 64bit Mail merge with filter using data inputted by user Office 2010 64bit
Novice
Mail merge with filter using data inputted by user
 
Join Date: Apr 2013
Posts: 4
Tornado70 is on a distinguished road
Default

Hi again,

Thanks for that. Before you posted again, I tried breaking down the rule for Date and Shift one at a time. The shift rule on it's own worked so I added a second SKIPIF line for the date and changed it pretty much to what you have above.
This then worked as I wanted, both Shift and Date filters working but entered as 2 separate lines, not sure if that causes any other issues but seems to work fine.

I will try changing back to 1 line as you have it and see how that goes.

Just 1 question though, what do the '1 0' parts do? I have those missed out and it works fine so just wondering what they do.

Once again thanks for the help.
Reply With Quote
  #6  
Old 04-08-2013, 08:54 PM
macropod's Avatar
macropod macropod is offline Mail merge with filter using data inputted by user Windows 7 64bit Mail merge with filter using data inputted by user Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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 Tornado70,

Quote:
what do the '1 0' parts do?
In each IF test, the output is either 1 or 0. The 1 or 0 from both IF tests are then multiplied, so that you get what is effectively an AND test (0*0=0, 0*1=0, 1*0=0, 1*1=1).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 04-09-2013, 07:16 AM
Tornado70 Tornado70 is offline Mail merge with filter using data inputted by user Windows 7 64bit Mail merge with filter using data inputted by user Office 2010 64bit
Novice
Mail merge with filter using data inputted by user
 
Join Date: Apr 2013
Posts: 4
Tornado70 is on a distinguished road
Default

Thanks for explaining, makes more sense now.

Looks like all is working so thanks for all your help.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail merge with filter using data inputted by user Mail Merge / DSN / Data Link / MySQL Bob Young Mail Merge 5 05-18-2012 03:44 PM
Mail merge with filter using data inputted by user Mail Merge - If a field is black, take the data from the row below? mikeprent Mail Merge 5 01-05-2012 04:52 AM
Mail merge with filter using data inputted by user Applying Filter to mail merge crashes word!!! sedain121 Mail Merge 1 06-28-2010 02:33 PM
How do I set up the fields in mail merge word 07 from my data base mbcrabber Mail Merge 4 06-06-2010 01:25 PM
Need help creating a data base for mail merge. acedking90 Mail Merge 0 07-27-2009 11:04 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:42 AM.


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