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  

Restrict records that match date criteria at merge time



 
 
Thread Tools Display Modes
  #1  
Old May 4th, 2004, 01:46 PM
Peter Wilde
external usenet poster
 
Posts: n/a
Default Restrict records that match date criteria at merge time

Im trying to prepare a standard letter that uses fields
from a database via ODBC and Microsoft SQL. At merge
time, what is the easiest way for the office secretaty to
restrict the output letters between two dates? Is it
possible to embed dialog boxes that would appear at merge
time? Any suggestions?
  #2  
Old May 5th, 2004, 08:40 AM
Cindy M -WordMVP-
external usenet poster
 
Posts: n/a
Default Restrict records that match date criteria at merge time

Hi Peter,

Im trying to prepare a standard letter that uses fields
from a database via ODBC and Microsoft SQL. At merge
time, what is the easiest way for the office secretaty to
restrict the output letters between two dates? Is it
possible to embed dialog boxes that would appear at merge
time?

Filtering using dates in mail merge is a tricky proposition;
the dialog box way, then adjusting the QueryString property,
is probably the "safest" way.

The basic approach I'd consider:

1. Use a macro named AutoNew (will execute when a new doc is
created from a template)

2. Have it display a UserForm (dialog box) with two text
boxes for the dates.

3. The code behind the "OK" button would check the dates for
validity (IsDate), then adapt the
ActiveDocument.MailMerge.DataSource.QueryString property.
Exactly how you want to do that will depend on whether it
previously has been modified in any way, or whether you can
write it from scratch, but the syntax is standard SQL for
the type of datasource you're using.

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

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 05:32 PM.


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