A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Mail Merge Disable Choose Data Source



 
 
Thread Tools Display Modes
  #1  
Old April 24th, 2004, 10:08 AM
Cindy M -WordMVP-
external usenet poster
 
Posts: n/a
Default 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 :-)

Ads
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:06 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2004-2018 OfficeFrustration.
The comments are property of their posters.