Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using MSAccess 2007 to Manage Mail Merge

Status
Not open for further replies.

dtay1132

IS-IT--Management
Nov 5, 2002
33
US
I have an MS Access 2007 DB we are using to record and track user requests in (sales type stuff). We are also using this db separately as the source for a merge document which creates a document that is printed and sent back to the requestor. I have looked in this forum and others for a clean way to open the base merge document from a button within Access 2007 for the current record or a group of records. Does anyone have a thread on how this can be achieved?
 
I did an small project for a lawyer,
I'm not for sure it is your scenario but let me tell you.

I did create an Systen DSN, using ODBC Data Source Administrator.

Then I call that DSN from the document (letter, receipt, FAX etc.)

Platform:
Windows 7
Microsoft Office 2007

I used:
ODBC
Word 2007 and ACESS 2007

Good luck!
 
@dtay1132

I tried a lot of different methods, but I found using the Word bookmarks instead of filling fields works so much cleaner. I have attached sample code. Hope it helps!

Sub
Dim WordObj As Word.Application
Dim WordDoc As Word.Document
Dim WordRange As Word.Range
Dim strName As String
Dim strCountry As String

Set WordObj = CreateObject("Word.Application")
Set WordDoc = WordObj.Documents.Open _
("C:\Some Directory\FILENAME.dotx")
WordObj.Visible = True

' Go to the bookmark named "TitleWholeName"
Set WordRange = WordDoc.Goto(What:=wdGoToBookmark, Name:="TitleWholeName")
WordRange.InsertAfter strName

' Go to the bookmark named "County"
Set WordRange = WordDoc.Goto(What:=wdGoToBookmark, Name:="County")
WordRange.InsertAfter strCounty

' Uncomment the next line of code to print the document.
' WordDoc.PrintOut Background:=False

' Uncomment the next line of code to save the modified document.
WordDoc.SaveAs ("C:\Directory\" Final_Document_Name.docx")

' Uncomment the line of code to quit Microsoft Word without
' saving changes to the document.
' WordObj.Quit SaveChanges:=wdDoNotSaveChanges

Set WordObj = Nothing

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top