Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2009

    Unanswered: 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:

    TransactionsID - Autonumber
    ClientFirstName - Text
    ClientLastName - Text

    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
    Join Date
    Aug 2009
    Up Nort' Wi
    Ummmm....what code?

    Good, fast, cheap...Pick 2.

  3. #3
    Join Date
    Oct 2009


    Sorry, here's the code I found online. How can I incorporate into my project?

    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 & "\"
    objWord.Visible = True
    'Add information to the template
    'With objWord.ActiveDocument
    .FormFields("PE").Result = rsData!PE
    '.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
    set rsData = Nothing
    End With
    'Exit Word
    'End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts