Results 1 to 2 of 2
  1. #1
    djreyrey is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    4

    Access and Word Automation

    Hello all. Ok, I ran into the code above and I think it's what I need. I'm not sure how I would modify it to work on my form. Here's my scenario:

    tblTransactions
    TransactionsID - Autonumber


    ClientFirstName - Text
    ClientLastName - Text

    frmDocuments
    txtClientNo - Number
    cmdProcess - When clicked, Access displays documents in lbxDocuments corresponding to client number entered in txtClientNo text box.
    lbxDocuments - This list box displays the documents that are available to the user. The user opens the document by double clicking on the document in the list.

    All of the above works perfectly! I just need to know how to incorporate the above code so that when the user double clicks on the document in the list box, the document will open, connect to table, and merge data from record # entered in txtClientNo. Would the process be different if I was doing this from a list box with multiple documents?

    Hope this all makes sense. I would love your assistance!

  2. #2
    djreyrey is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    4
    By the way, here's the code I'm reffering to:

    Code:
    Private Sub cmdBlurbRequest_Click()
    
    Dim rsData as DAO.Recordset
    Dim strSQL as String
    
    strSQL = "Select * from Junction Where Primary Key = " & Me.txtFileNo
    
    set rsData = CurrentDB.OpenRecordSet(strSQL)
    
    'Launch word and load the template
    Dim objWord As Word.Application
    Set objWord = CreateObject("Word.Application")
    objWord.Documents.Add Application.CurrentProject.Path & "\BlurbRequest.dot"
    objWord.Visible = True
    
    'Add information to the template
    'With objWord.ActiveDocument
    '.Unprotect
    
    .FormFields("PE").Result = rsData!PE
    '.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
    
    rsData.Close
    set rsData = Nothing
    
    End With
    
    'Exit Word
    'objWord.Quit
    'End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Mail Merge from Access to Word
    By Rachelkm2 in forum Programming
    Replies: 1
    Last Post: 05-29-2009, 02:49 PM
  2. access to word please help!
    By fiesta_rich in forum Import/Export Data
    Replies: 2
    Last Post: 04-14-2009, 09:27 PM
  3. Word document INTO Access form
    By jonathonhicks in forum Forms
    Replies: 0
    Last Post: 04-30-2007, 05:59 PM
  4. access 2003 automation issue
    By BevA in forum Programming
    Replies: 2
    Last Post: 05-01-2006, 08:37 AM
  5. Replies: 1
    Last Post: 12-21-2005, 12:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums