If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Mail Merge Disable Choose Data Source
Hi Mariatherp,
I have set up a merge filter. If there is no data meeting the criteria the users will receive this message: "Word could not merge the main document with the data source because the data records were empty or no data records matched your query options." At this point I would like a msg box to come up "goodbye" and close word. But Word allows the user to choose a new data source. You'd have to handle all of this through a macro (VBA). Once you have the merge filter defined in SQL syntax, don't send it to Word's .QueryString property immediately. Instead, use ADO or DAO to connect to the same data source, using this SQL. Check the number of records in the recordset, and if it's 0, display the message you wish. If it's 0, go ahead and do the Word stuff. Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003) http://www.word.mvps.org This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-) |
Thread Tools | |
Display Modes | |
|
|