[AccessD] AXP and Word

Terri Jarus jarus at amerinet-gpo.com
Wed Jul 7 14:29:08 CDT 2004


That was way too easy.  Thank you so much.
 
Terri Jarus
Director, Contract Support Services
jarus at amerinet-gpo.com
314-542-1902

>>> Developer at ultradnt.com 07/07/04 12:48PM >>>
An unqualified Dim of a recordset will get you an ADO recordset, but
the
form's recordset is DAO, hence the type mismatch.

Change:
Dim rst As Recordset to:
Dim rst As DAO.Recordset

Hth
Steve



-----Original Message-----
From: accessd-bounces at databaseadvisors.com 
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Terri Jarus
Sent: Wednesday, July 07, 2004 12:54 PM
To: accessd at databaseadvisors.com 
Subject: [AccessD] AXP and Word


I have set up Word Automation to create a really nice document that is
created from pushing the button on a form.  That, of course, creates
the
Word doc for the current record.

Now I have a form that pulls back a select grouping of records based
on
a date and I want to send them to the same Word document.  So I would
have a continuous document moving through each record.

I've tried Do...While, but I'm not getting it set up correctly.  I get
a
type mismatch error on "Me.Recordset".

Thanks for any help or suggestions.

A sample of my code follows:

Private Sub cmdAnnounce_Click()

Dim objWord As Word.Application
Dim filename As String
Dim rst As Recordset

Set rst = Me.Recordset
    
    Set objWord = New Word.Application
    
    filename = "U:\Suppliers\Reports\Contract
Sales\EForm\ContInfoNEW\mktg_announce.dot"

  If Not (rst.BOF And rst.EOF) Then
  rst.MoveFirst
  
Do
  
    With objWord
    
        On Error GoTo MsgInfo
        .Visible = True
    
            
        .Documents.Add _
            Template:=filename, _
            NewTemplate:=False
            
                  .Selection.GoTo _
                    What:=wdGoToBookmark, _
                    Name:="SupplierName"
                    
                .Selection.TypeText _
                    Text:=SupplierPrintName
                    
                 .Selection.GoTo _
                    What:=wdGoToBookmark, _
                    Name:="ContractNumber"
                    
                .Selection.TypeText _
                    Text:=ContractNumber
                
                .Selection.GoTo _
                    What:=wdGoToBookmark, _
                    Name:="PDU"
                    
                .Selection.TypeText _
                    Text:=Prog
                    
        objWord.Selection.TypeParagraph
        objWord.Selection.MoveDown Unit:=wdLine

        .Quit
        
        End With
            rst.MoveNext
        Loop
        End If
        rst.Close
        
        Set objWord = Nothing
       
        
MsgInfo:
    On Error Resume Next
    'MsgBox "There is a required field missing information, please
recheck your CDS data.  Enter any required data into the Contract Info
database."
    Exit Sub

End Sub

Terri Jarus
Director, Contract Support Services
jarus at amerinet-gpo.com 
314-542-1902

------------------------------------------------------------------------
---
This email and any files transmitted with it are confidential and
intended solely for the use of the individuals or entities to whom
they
are addressed. If you have received this email in error please return 
it to the sender, and erase any copies thereof.
Copyright 2004 Amerinet 1nc.
-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com 
http://databaseadvisors.com/mailman/listinfo/accessd 
Website: http://www.databaseadvisors.com 

-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com 
http://databaseadvisors.com/mailman/listinfo/accessd 
Website: http://www.databaseadvisors.com 




More information about the AccessD mailing list