Reply
 
Thread Tools Display Modes
  #1   Report Post  
Nick
 
Posts: n/a
Default Add 1 to count when printing document

I want to count the number of times I am sending out reminder notices.
To do this I want to add 1 to a field in my db, called nosent, every time I
print the mailmerged document, can anybody help.
  #2   Report Post  
Peter Jamieson
 
Posts: n/a
Default

Word Mailmerge has no built-in facilities that let you update a data source,
so you would have to use a macro to do this. There are various approaches,
depending on the version of Word. In Word 2002 and 2003, you can use the
Events of the Mailmerge object to run a piece of code one time for each
record being merged. Suppose your data is in an Access table. Then your
event handler could use ADO to open another connection to the database, and
update the current record. Earlier versions of Word do not have these
events, so your macro might do the merge first, then iterate through tthe
records in the datasource (using the Mailmerge object) and use ADO to update
each record in turn. (Actually, in theory, you might be able to take the SQL
used to query the database and turn it into an UPDATE query that updated all
the affected records in one go, but I suspect going that route would be
asking for trouble).

You are likely to encounter at least three problems:
a. if for some reason, your merge fails but your update does not, your
counters will not be accurate (e.g. if you perform the merge but the printer
is out of paper and you have to cancel and restart).
b. some data sources will be easier to work with than others - for example,
you can use ADO or perhaps DAO to work with Access, SQL Server etc., but
things might be more difficult if your source is a Word document or a text
file
a. Depending on the data source and the connection type, you may not be
able to open a new connection to the data source while Word is performing
the merge.

Peter Jamieson
"Nick" wrote in message
...
I want to count the number of times I am sending out reminder notices.
To do this I want to add 1 to a field in my db, called nosent, every time
I
print the mailmerged document, can anybody help.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Corrupt fonts when printing a merged document Mark J Barefoot Mailmerge 3 March 20th 05 08:17 PM
Printing an A3 document on A4 paper ChasHyde Microsoft Word Help 0 February 14th 05 02:31 AM
How do I get a Word document created for printing shipping labels. Judy A. Mailmerge 1 January 29th 05 09:09 AM
Problems printing merged document Alejandra Parra Mailmerge 0 January 12th 05 06:36 PM
How do I print the word count onto my word document prmiaj Microsoft Word Help 1 January 8th 05 07:13 PM


All times are GMT +1. The time now is 03:35 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"