I have a form which which prompts the user for a date range and a command button which creates a Word object, opens a template I've written, sets an Access query as its data source, and does the mail merge (based on the code in http://support.microsoft.com/?kbid=285332
Now, the Access query takes the date values in the two textboxes to run the query. MS Word obviously can't see what these date values are (or the query at all) because you're setting the data source directly in code.
What's the best way of getting Word to use a parameterized Access query and populate the parameters with the values entered in the form? Is there a better way of doing it than dropping the query in VBA and creating it again, hardcoding the dates? Hope I've explained myself well. Any thoughts appreciated. Thanks.