Access97-Word97 Mail Merge 
Author Message
 Access97-Word97 Mail Merge

I have treid to get this info but I can't seem to make any of the
versions in the books to do a mail merge using a Access97 query as data
source (qryDAtaForDrChargeSheets) and a Word97 merge file
(mrgDrCahrgeSheet.doc). I am trying to start this merge to preview then
print from an Access form. Most of the book's examples my version gets
stuck somewhere in the middle. For example in the example below it gets
to wrd.Documents.Open and I get a message "compile error - Method or
data member not found". I really am not trying to wast your time but I
seem to be missing something basic and not skilled enough to find out
what it is.

Any help would be GREATLY appreciated


Private Sub cmdBillingSheets_Click()
    Dim wrd As Application
    Dim MyMerge As Word.MailMerge

    Set wrd = Word.Application
    wrd.Visible = True 'Only to show effect
    wrd.Documents.Open FileName:="c:\PatLog\mrgDrChargeSheet.doc"
    Set MyMerge = wrd.ActiveDocument.MailMerge
    If MyMerge.State = wdMainAndDataSource Then
        With MyMerge
            .DataSource.FirstRecord = 1
            .DataSource.LAstRecord = 2
            .Destination = wdSendToPrinter
        End With
        Do While wrd.BackgroundPrintingStatus <> 0
            DoEvents  'Let word print the document.
    End If
    wrd.ActiveDocument.Close SaveChanges:=False
End Sub
Gregg C Lund, DO, FAAP     Newborn and Pediatric HealthCare Associates

Phone - 214-343-6663       FAX - 972-733-1995

Thu, 16 Sep 1999 03:00:00 GMT  
 Access97-Word97 Mail Merge

I am confused as ever but I might be getting closer. In the MS KB I
found a reference to doing the merge.(see below). If directed me to form
a Function called MergeIt(). Running this function from the module
design mode I get the merge to occur, but I have not been able to get it
to print without clicking the print mode of Word. But I can't close the
thing and move on. Also I cannot figure out how to do this without
seeing Word (kind of make it look like magic) I just make the
objWord.Application.Visible = False?.

One final thing.....once I get the thing to work how do I place this as
an OnClick event of an Access form.

I know this is a bit of a pain but I really appreciate your help.


Function MergeIt()
    Dim objWord As Word.Document
    Set objWord = GetObject("C:\patLog\mrgDrChargeSheet.doc",
"Word.Document") ' Make Word visible.
    objWord.Application.Visible = True 'makes WORD visible

    objWord.MailMerge.OpenDataSource Name:="C:\patlog\ptlog.mdb",
LinkToSource:=True, Connection:="QUERY qryDataForDrChargeSheets" ' Set
the mail merge data source as database query

    objWord.MailMerge.Destination = wdSendToPrinter
    objWord.MailMerge.Execute ' Execute the mail Merge.

End Function

Gregg C Lund, DO, FAAP     Newborn and Pediatric HealthCare Associates

Phone - 214-343-6663       FAX - 972-733-1995

Fri, 17 Sep 1999 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Mail Merge access97 with word97 (Blank spaces)

2. Access97->Word97 merge, buffer overflow?

3. lauching Word97 mail merge from VB

4. PLEASE: Mail Merge Help with VB5 and Word97

5. --- Word Mail Merge from Access97

6. Mail Merge BarCodes / Mail Merge Insertion Point

7. Formatting Merge Fields in Word Mail Merge

8. Word Mail Merge Err - Word could not merge...

9. Help sending HTML mail in mail merge

10. HTML forms, Word, e-mail and mail merge

11. creating word mailing labels with Mail Merge

12. Attachments for e-mail in mail merge


Powered by phpBB® Forum Software