Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
George Adams George Adams is offline
external usenet poster
 
Posts: 4
Default Mail-merging with Word, MySQL... and Perl?

I'm trying to do a mail-merge in Microsoft Word 2003 using an ODBC
connection to my MySQL database on my Linux box. The finished product
will be a paper name/address/phone/etc. directory for our church.
Normally this would work fine, except I don't want to just simply grab
and merge the data from certain fields in the database. I need to be
able to insert some programming logic.

For instance, I'll want to look at the age of the children listed in the
database, and if they're older than (say) 18, I won't display their
birthday. Or if a couple has its anniversary listed, I'll want to
format that in BOLD and display it. Or if the listed person is a
member, I'll want to format their name in a slightly different way.
etc. etc. All of which is a little much for SQL to handle (or at least
for *me* to handle in SQL).

For a normal project, this would be a simple job for Perl. What I can't
figure out is, is there anyway to insert Perl into this mail-merge
process? Obviously MS-Word wants to query a database over ODBC, not a
Perl script. Is there a way to change that so Word will get its data
from the Perl script directly (which would be written to generate that
data in whatever format Word is looking for it?)

Thanks to anyone who can help!
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Mail-merging with Word, MySQL... and Perl?

You should be able to do what you want using If...then...Else fields in the
mail merge main document.

For example

{ IF { MERGEFIELD Age } 18 "{ MERGEFIELD Birthdate }" "" }

{ IF { MERGEFIELD Anniversary } "" "{ MERGEFIELD Anniversary \*
Charformat }" "" }

To get the Anniversary displayed as Bold text, apply Bold formatting to the
M in "{ MERGEFIELD Anniversary \* Charformat }"

You must use Crtl+F9 to insert each pair of field delimiters { } and you use
Alt+F9 to toggle off their display.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"George Adams" wrote in message
...
I'm trying to do a mail-merge in Microsoft Word 2003 using an ODBC
connection to my MySQL database on my Linux box. The finished product
will be a paper name/address/phone/etc. directory for our church. Normally
this would work fine, except I don't want to just simply grab and merge
the data from certain fields in the database. I need to be able to insert
some programming logic.

For instance, I'll want to look at the age of the children listed in the
database, and if they're older than (say) 18, I won't display their
birthday. Or if a couple has its anniversary listed, I'll want to format
that in BOLD and display it. Or if the listed person is a member, I'll
want to format their name in a slightly different way. etc. etc. All of
which is a little much for SQL to handle (or at least for *me* to handle
in SQL).

For a normal project, this would be a simple job for Perl. What I can't
figure out is, is there anyway to insert Perl into this mail-merge
process? Obviously MS-Word wants to query a database over ODBC, not a
Perl script. Is there a way to change that so Word will get its data from
the Perl script directly (which would be written to generate that data in
whatever format Word is looking for it?)

Thanks to anyone who can 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
Word 2002 Mailmerge using data from MySQL Phillip Dade Mailmerge 1 April 11th 07 07:29 PM
MDE and Mail Merging w/ Word Tatakau Mailmerge 0 November 9th 05 04:11 PM
Mail merging into a word document. Raj Mailmerge 1 August 19th 05 12:10 PM
Outlook/Word Mail Merging - Bug? SianH Mailmerge 3 April 29th 05 08:43 PM
±M·~ºô­¶±H¦sªA°È ¦P¨B¤ä´© PHP+MySQL, Access+ASP, ASP.NET, CGI, SSI ¹q¶l¯f¬r¹LÂo, ©U§£¹q¶l¹LÂo ¤ÎWebMail .................................................................................................................................................. [email protected] Page Layout 0 February 19th 05 10:27 AM


All times are GMT +1. The time now is 06:42 PM.

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"