By Ben Lamb, 4th February 2005
Unfortunately, if your MS Query uses parameters, you can't just run the MS Query from Word, you'll probably get the following error:
Excel however, will run the query without a problem. This means if you want to use a query that has parameters you must first run it in Excel, save it to a worksheet, and mail merge with the worksheet data.
If you are at the end of the query wizard click "Return Data to Microsoft Office Excel" and then click "Finish". Or if you are in Microsoft Query go to File->Return Data to Microsoft Office Excel
You will now be returned to Microsoft Excel and the data from your query will get loaded into the cells.
To change any parameters you are using you must refresh the data. You can do this by right clicking on any of the fields produced in Excel and choose refresh data.
Simply enter a parameter when asked.
And the report will change based on the parameter you entered.
Once Excel has the data you are after, save the Excel document and open Word
The most common mail merge functions can be accessed from the Mail Merge toolbar. To add this toolbar, go to
Tools -> Letters and Mailing -> Show Mail Merge Tool Bar
This will display a Mail Merge toolbar to the screen.
To connect to the data source (excel file), you must open a data source. This is done by clicking the 'Open Data Source' button shown below.
Find the Excel file you saved and click open
The "Select Table" window will appear, select the worksheet that has your query attached.
Now that the connection is set up, go to Using Mail Merge.