Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
MorningStarFan MorningStarFan is offline
external usenet poster
 
Posts: 7
Default advanced mail merge of letters and reports

Hi All,

We have used automation to create documents via word mailmerge from our
access db. We can just press a button and as long as all our dbs and files
are in place, it works great! Except for our records that need to have
multiple recipients for one letter, multiple student awards for one recipient
award report, etc. Does anyone know how we could modify the code and the
documents or the data or a combination of some or all so that when multiple
students have been recipients for a single scholarship fund one award report
is produced? See our code that we are currently using to create the documents
below...We could have three donors to thank in a letter or one or two. We
could also have one, two, three or more students data to print on an award
report.


Function MergeIt_Awards()
Dim objWord As Word.Document
Set objWord =
GetObject("C:\Stewardship_automation\STUDENT_AWARD S_REPORT_3.doc",
"Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as db2.
objWord.MailMerge.OpenDataSource _
Name:="C:\Stewardship_automation\" & _
"db2.mdb", _
LinkToSource:=True, _
Connection:="TABLE QRY_FORMAL_FUNDNAME", _
SQLStatement:="SELECT * FROM [QRY_FORMAL_FUNDNAME]"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function

Thanks in advance!


--
MorningStarFan
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default advanced mail merge of letters and reports

I think what you're asking for is a "multiple items per condition" type
merge,
which Word cannot really do out of the box - for approaches, see e.g.

http://homepage.swissonline.ch/cindy...r/mergfaq1.htm

http://support.microsoft.com/default...b;en-us;211303

You can also consider using Access reporting.

If you're only producing one letter/document at a time, things may be
slightly easier as long as you have a known maximum number of items on the
letter/document (because then you may be able simply to repeat

{ NEXT}{ MERGEFIELD field1 }{ MERGEFIELD field2 }

the maximum number of times they can possibly occur (and there are other
possible approaches).

Peter Jamieson

"MorningStarFan" wrote in message
...
Hi All,

We have used automation to create documents via word mailmerge from our
access db. We can just press a button and as long as all our dbs and files
are in place, it works great! Except for our records that need to have
multiple recipients for one letter, multiple student awards for one
recipient
award report, etc. Does anyone know how we could modify the code and the
documents or the data or a combination of some or all so that when
multiple
students have been recipients for a single scholarship fund one award
report
is produced? See our code that we are currently using to create the
documents
below...We could have three donors to thank in a letter or one or two. We
could also have one, two, three or more students data to print on an award
report.


Function MergeIt_Awards()
Dim objWord As Word.Document
Set objWord =
GetObject("C:\Stewardship_automation\STUDENT_AWARD S_REPORT_3.doc",
"Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as db2.
objWord.MailMerge.OpenDataSource _
Name:="C:\Stewardship_automation\" & _
"db2.mdb", _
LinkToSource:=True, _
Connection:="TABLE QRY_FORMAL_FUNDNAME", _
SQLStatement:="SELECT * FROM [QRY_FORMAL_FUNDNAME]"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function

Thanks in advance!


--
MorningStarFan



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
MorningStarFan MorningStarFan is offline
external usenet poster
 
Posts: 7
Default advanced mail merge of letters and reports

Thanks! I was wondering if this could even be done or not. I will let you
know if we get one of the workarounds to accomplish our goal here.
--
MorningStarFan


"Peter Jamieson" wrote:

I think what you're asking for is a "multiple items per condition" type
merge,
which Word cannot really do out of the box - for approaches, see e.g.

http://homepage.swissonline.ch/cindy...r/mergfaq1.htm

http://support.microsoft.com/default...b;en-us;211303

You can also consider using Access reporting.

If you're only producing one letter/document at a time, things may be
slightly easier as long as you have a known maximum number of items on the
letter/document (because then you may be able simply to repeat

{ NEXT}{ MERGEFIELD field1 }{ MERGEFIELD field2 }

the maximum number of times they can possibly occur (and there are other
possible approaches).

Peter Jamieson

"MorningStarFan" wrote in message
...
Hi All,

We have used automation to create documents via word mailmerge from our
access db. We can just press a button and as long as all our dbs and files
are in place, it works great! Except for our records that need to have
multiple recipients for one letter, multiple student awards for one
recipient
award report, etc. Does anyone know how we could modify the code and the
documents or the data or a combination of some or all so that when
multiple
students have been recipients for a single scholarship fund one award
report
is produced? See our code that we are currently using to create the
documents
below...We could have three donors to thank in a letter or one or two. We
could also have one, two, three or more students data to print on an award
report.


Function MergeIt_Awards()
Dim objWord As Word.Document
Set objWord =
GetObject("C:\Stewardship_automation\STUDENT_AWARD S_REPORT_3.doc",
"Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as db2.
objWord.MailMerge.OpenDataSource _
Name:="C:\Stewardship_automation\" & _
"db2.mdb", _
LinkToSource:=True, _
Connection:="TABLE QRY_FORMAL_FUNDNAME", _
SQLStatement:="SELECT * FROM [QRY_FORMAL_FUNDNAME]"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function

Thanks in advance!


--
MorningStarFan




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Kathy Webster Kathy Webster is offline
external usenet poster
 
Posts: 23
Default advanced mail merge of letters and reports

I was wondering if you could help me with merging from Access in a similar
way. The difference is, I want the resulting merged text to be left on the
screen in Word, then disconnect or unlink from the data source once the
merge is complete.
Thanks!

"MorningStarFan" wrote in message
...
Hi All,

We have used automation to create documents via word mailmerge from our
access db. We can just press a button and as long as all our dbs and files
are in place, it works great! Except for our records that need to have
multiple recipients for one letter, multiple student awards for one
recipient
award report, etc. Does anyone know how we could modify the code and the
documents or the data or a combination of some or all so that when
multiple
students have been recipients for a single scholarship fund one award
report
is produced? See our code that we are currently using to create the
documents
below...We could have three donors to thank in a letter or one or two. We
could also have one, two, three or more students data to print on an award
report.


Function MergeIt_Awards()
Dim objWord As Word.Document
Set objWord =
GetObject("C:\Stewardship_automation\STUDENT_AWARD S_REPORT_3.doc",
"Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as db2.
objWord.MailMerge.OpenDataSource _
Name:="C:\Stewardship_automation\" & _
"db2.mdb", _
LinkToSource:=True, _
Connection:="TABLE QRY_FORMAL_FUNDNAME", _
SQLStatement:="SELECT * FROM [QRY_FORMAL_FUNDNAME]"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function

Thanks in advance!


--
MorningStarFan



  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default advanced mail merge of letters and reports

As long as you set

objWord.MailMerge.Destination = wdSendToNewDocument

then after you .Execute, the new document should be the ActiveDocument, and
the Mail Merge Main document can still be referenced by objWord, so you
can...

- close the Mail Merge Main Document:

objWord.Close SaveChanges:=False

- or disconnect the data source:

objWord.MailMerge.MainDocumentType = wdNotAMergeDocument

(or in Word 2003 you can probably use)

objWord.MailMerge.DataSource.Close

- or both.

Peter Jamieson


"Kathy Webster" wrote in message
ink.net...
I was wondering if you could help me with merging from Access in a similar
way. The difference is, I want the resulting merged text to be left on the
screen in Word, then disconnect or unlink from the data source once the
merge is complete.
Thanks!

"MorningStarFan" wrote in
message ...
Hi All,

We have used automation to create documents via word mailmerge from our
access db. We can just press a button and as long as all our dbs and
files
are in place, it works great! Except for our records that need to have
multiple recipients for one letter, multiple student awards for one
recipient
award report, etc. Does anyone know how we could modify the code and the
documents or the data or a combination of some or all so that when
multiple
students have been recipients for a single scholarship fund one award
report
is produced? See our code that we are currently using to create the
documents
below...We could have three donors to thank in a letter or one or two. We
could also have one, two, three or more students data to print on an
award
report.


Function MergeIt_Awards()
Dim objWord As Word.Document
Set objWord =
GetObject("C:\Stewardship_automation\STUDENT_AWARD S_REPORT_3.doc",
"Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as db2.
objWord.MailMerge.OpenDataSource _
Name:="C:\Stewardship_automation\" & _
"db2.mdb", _
LinkToSource:=True, _
Connection:="TABLE QRY_FORMAL_FUNDNAME", _
SQLStatement:="SELECT * FROM [QRY_FORMAL_FUNDNAME]"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function

Thanks in advance!


--
MorningStarFan





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
Advanced Mail Merge Hootie Mailmerge 1 April 10th 07 02:11 PM
Advanced Word 2003 Mail Merge: Combining Records [email protected] Mailmerge 10 January 25th 07 10:56 PM
Is mail merge good for writing reports? ejlopezzzz Microsoft Word Help 3 September 16th 06 06:19 AM
Mail Merge and Letters Lisa Microsoft Word Help 0 April 19th 05 02:44 AM
Mail Merge Letters TomC Mailmerge 3 February 12th 05 03:51 AM


All times are GMT +1. The time now is 03:49 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"