Mail Merge - Guidance on how to mark records as merged

Castaway78 used Ask the Experts™
Hi all -

So, here's my situation.

I have a SQL Server with a bunch of records. I need to create labels for the records. My department is always adding new records, and we're always needing to print more labels.

I created a Word 2007 mail merge document that creates such labels, and filters on a boolean (bit) field called LabelPrinted.  So, all my coworkers need to do is open the Word document, hit merge, and boom, done.

However, I am stuck at how to then mark the records as LabelPrinted=true

Can someone point me in the right direction for the most efficient and smoothest way to do this?

Is there some built in function within Word to do this? Or do I need to resort to VBA code? Or something else?

If VBA, what logic should I use? I'm experienced with VBA from Excel... I'm sure I can stumble through Word with some guidance.

I hope that all makes sense. I'm just looking for a starting point as to how I should go about this... I want to figure out the nitty gritty myself.


Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

I don't think there is a built-in function in Word for this.  I would go with VB - I have updated database records using VB in Excel and I am sure Word would be quite similar.

It sounds like you don't want specifics so I won't post any, but if you want more detail let us know.

Good luck!


Okay, so with VBA... how would I go about doing that?  (The actual code that does the SQL Update I'm good with)

Is there a AfterMerge event, or something similar that I could use to trigger the update? I'm just trying to figure out how I would go about doing that?

Or would I need to create a custom interface that starts the merge and updates the SQL all in one?
There is an AfterMerge event, and I'm assuming you are already using VBA to call the database and record set (Dim db as database, rs as recordset, or similar ...), so you can update the batch of records that are already identified.


The recordset is being called via the merge itself... at this point, I haven't created any VBA code.

So, it's looking like putting in an Update command into the AfterMerge event will work nicely.

Thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial