Mail merge from DataSet

  • Thread starter Thread starter Mike Stephens
  • Start date Start date
M

Mike Stephens

A contact management application we previously developed for a customer now
has a requirement to perform mail merging. Normally request like this would
be very simple to solve, we were just point the mail merge data source to
the database. But this request is a little bit different. The customer
needs to perform the mail merge from the contacts in a dataset.

Example
In the main contact window the client has the ability to filter contact is
based on various details. After performing a filter the contacts in the
dataset are limited or expanded based on the new filter. The customer then
needs to open a Word document and perform a mail merge with the contacts in
the current dataset. The customer will NOT be opening the Word document from
the application.

The only option I can see is is by adding a new tool button the customer
clicks to export the data to a new database of which, the Word document uses
as its data source.preferably, I do not want to export any data and would
prefer (if possible) to use the dataset directly.

Any thoughts and suggestions on this would be greatly appreciated.

Regards,
Mike
 
Hi Mike,

You're on the right track.

I do the very same thing and here's how I do it:

I zap an sql server table and then load it with the data from the filtered
dataset. The Word merge file is called through a macro that loads the table
in question and posts the data into each page, per client (or, in your case,
per contact).

So, when my client opens Word, he need only run the macro, which opens and
populates the merge file. I have taken it one step further with 'do you
wish to open Word now?' and if so, I call the macro directly from vb .net:

macroname_ = "/mwelcome"

longstringname_ = globalmsopath & "\winword.exe " & "f:\imcapps\docs\" &
mergeletterbox.Text & " " & macroname_

Shell(longstringname_, AppWinStyle.NormalFocus, False, -1)

HTH,

Bernie Yaeger
 
Back
Top