Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Corrupt fonts when printing a merged document | Mailmerge | |||
Printing an A3 document on A4 paper | Microsoft Word Help | |||
How do I get a Word document created for printing shipping labels. | Mailmerge | |||
Problems printing merged document | Mailmerge | |||
How do I print the word count onto my word document | Microsoft Word Help |