This post is about an interesting problem that came to me by e-mail about a mail merge problem in Microsoft Word.
Someone from a training company wanted to send out summary data about in-progress courses to every student by e-mail. As every message would require a number of different records, it seemed logical to use the 'Directory' option. That wasn't a good solution, however, as the sender wanted to be able to use the e-mail integration features of the 'Letter' option. Here's how to use some 'Directory' features using 'Letters'.
1- Start a mail merge document using the 'Letters' option, and set up everything in your letter (including the data source).
2 - Go to the Insert Field dialog box (not a mail merge field, but just the regular fields) and choose 'Database' from the categories. Click on the 'Insert Database' button.
3 - Click on the 'Get Data' button, and choose the same data source that you used for your mail merge.
4 - Click on the 'Query Options...' button. Go to the Select Fields tab and make sure the right-hand list contains only those fields that you want to see in the table.
5 - Click on the 'Filter Records' button, and set up a criteria for the UserID field to be 'Equal to' arealuserid (choose any existing UserID and put it here - you will change this later, so it doesn't matter which one you pick). Click the 'OK' button.
6 - Click on the 'Insert Data...' button, and place a checkmark in the 'Insert data as field' checkbox. Click the 'OK' button.
7 - Now you should be back in your document, and you'll see a table there that shows the records for the UserID you chose. Press Alt+F9, and you'll be able to see the field codes. It will probably look like a mess. That's a good thing.
8 - Look right near the bottom of all of that code, and you will see a SELECT statement. In this statement, highlight where you had entered a random UserID, and now go up to your toolbar and insert the UserID mail merge field. What you're doing is setting the criteria to be equal to whichever UserID is currently being used for the mail merge. Make sure you keep the single quotes around the mail merge field and are only replacing the actual UserID.
9 - At this point, you might want to hit Alt+F9 again to stop seeing all of that code. Try to finish your mail merge, and you should see separate tables for each individual letter.