Form Letter

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I would like to make an editable letter head in MS Access. How would
I go about this.
what I would like it to do is allow me to type in a subject and body
then access would add in the names and addresses from the database.

Thanks
Dave
 
Given the lack of detail in the functionality you want one can only guess
your intent.

Microsoft Word's Mail Merge functionality is very powerful and flexible.
Have you tried it?

You can do lots of things with Access but it would be a shame to overlook
better tools in order to stay within Access.

HTH
 
To add to Larry's post, another way to go about putting data into form
letters is to use OLE automation to control Word and fill bookmarks in a
template (.DOT file). Some code that you can play with to familiarize
yourself with the concepts is found below.

First, create a Word template for your form letter. For this example, the
document name is C:\FormLetter.dot. In this template, you'll use the
Insert|Bookmark command to create a bookmark at each location in the text
where you'll want to insert Access data. For this example, I'm using simple
Name and Address fields.

In Access, open any Module in design view. Then select Tools|References and
make sure that you have a reference to the appropriate Word library. Look
for "Microsoft Word xx.x Object Library, where xx.x is the Word version
number. For this example, you will also need a reference to DAO.

' Behind a command button on a form, insert the following code.

BEGIN CODE SAMPLE:

Dim objWord As Object

' Open Microsoft Word using automation
Set objWord = New Word.Application

objWord.Documents.Add "c:\FormLetter.dot"
objWord.Visible = True

' The following code is generated from your Access form while it is
' manipulating an instance of Word.
' So, while it looks somewhat like VBA, it's really Word VBA.

If objWord.ActiveDocument.Bookmarks.Exists("FirstName") = True Then
objWord.ActiveDocument.Bookmarks("FirstName").Range.Text = me!FirstName
End If

If objWord.ActiveDocument.Bookmarks.Exists("LastName") = True Then
objWord.ActiveDocument.Bookmarks("LastName").Range.Text = me!LastName
End If

' ... continue reading data from form and inserting into bookmark

END CODE SAMPLE
 
Thanks for the replies! I wasn't expecting an answer to use another
program and I hadn't considered it, but I think it may be the best way
to go.
Thanks for your help
Dave
 
Back
Top