UtterAccess.com
Thank you for your support!      
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

> Merge To Word    
 
   
LenaWood
post Dec 29 2004, 12:24 PM
Post #1

UtterAccess Ruler
Posts: 1,341
From: Hermiston, OR - Umatilla Chemical Agent Disposal F



I have created a word template (\\rdc1\Surety\Surety Reviews\SuretyReview.dot) and added all the required bookmarks.

I want to merge only the records that are found using the following criteria. "SELECT * FROM qryInspectionReport WHERE InspNumber = [Forms]![frmInspectionReportMenu]![txtIDNumber]"

I have placed some bookmarks in the Page Header of my Word Template (as I need these to print on each page) including:

Word Bookmark -- Access Field Name

InspNum -- InspNumber
Agency -- Agency
IStartDate -- ISDate
IEndDate -- IEDate
ITitle -- InspectionTitle

In the "Body" of the Word Document I have other bookmarks:

FNumber -- FindingNum
FDate -- FDate
Reviewer -- Reviewer
ControlNum -- ExternalControlNumber


and a few others.

Each record that is found matching the criteria needs to generate a new page in the Word Template (not a new document)...so if I have 10 records matching my criteria I will end up with at least 10 pages in my Word Document.

The information in the header (the one side of the relationship) will always be the same with the information in the "Body" (the many side of the relationship) changing.

I have an example of doing a merge with a word document, but it is more like a letter...not having to loop through a bunch of records.

How would I go about doing this?

Thanks!
Lena
Go to the top of the page
 
+
 
Start new topic
Replies
NoahP
post Dec 30 2004, 09:27 AM
Post #2

UA Editor + Utterly Certified
Posts: 10,493
From: Lexington/Louisville KY USA



See if the attached demo helps. You will have to do a couple of things to get it to work properly:

1) Unzip the db and the Word document.
2) Open the Word doc and link it to tblMailMerge in the database. Make sure you check the 'Select Method' box and choose ODBC as the method. Otherwise, you may get multiple instances of Access opened up during the mail merge.
3) In the code for the mail merge form, change strPathtoYourDocument to the actually path to the Word doc.

The code I provided does require that the Microsoft Word library reference be active.

HTH
Noah
Go to the top of the page
 
+

Posts in this topic
- LenaWood   Merge To Word   Dec 29 2004, 12:24 PM
- - Doris   Re: Merge To Word   Dec 29 2004, 01:05 PM
- - LenaWood   Re: Merge To Word   Dec 29 2004, 02:28 PM
- - LenaWood   Re: Merge To Word   Dec 29 2004, 02:56 PM
- - LenaWood   Re: Merge To Word   Dec 29 2004, 03:13 PM
- - NoahP   Re: Merge To Word   Dec 29 2004, 04:51 PM
- - LenaWood   Re: Merge To Word   Dec 29 2004, 04:58 PM
- - NoahP   Re: Merge To Word   Dec 30 2004, 09:27 AM
- - LenaWood   Re: Merge To Word   Jan 3 2005, 11:43 AM


Reply to this topicStart new topic

 



RSS Go to Top  ·  Lo-Fi Version Time is now: 4th February 2012 - 11:22 PM