Access and Word Automation

djreyrey

Registered User.
Local time
Today, 11:32
Joined
Nov 19, 2005
Messages
25
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!
 
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!

No sense at all - what code are you using ? have you looked at super easy word ?
 
I'm using this code I found online. But I'm not sure how to incorporate it into my project:

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
 

Users who are viewing this thread

Back
Top Bottom