B
Bakema
Hi,
I have data on a single form in Access that I want to use
to populate some fields in a single Word letter (thus not
a real mail merge).
My approach has been to put a button on the form that
opens the Word document, which all works fine. Now I am
trying to locate the field in the Word document as
follows:
On Error GoTo Err_cmdWrd_Click
Dim objApp As Object
Dim txtA As TextBox 'this is txtbox in Access
Dim fldT As Field 'this is the field in the Word doc
Dim docW As Document
strDocName = "C:\TestWord"
Set txtA = txtPONo
Set objApp = CreateObject("Word.Application")
objApp.Visible = True
objApp.Documents.Open strDocName
Set docW = Word.Application.ActiveDocument
'Up to here no problems
'Next line is supposed to identify the field in the Word
document:
Set fldT = ????? 'and this is where I get stuck
'once I have identified the field I would like to
populate it like this:
fldT = txtA
Can this work, or is this nonsense??
Bakema
I have data on a single form in Access that I want to use
to populate some fields in a single Word letter (thus not
a real mail merge).
My approach has been to put a button on the form that
opens the Word document, which all works fine. Now I am
trying to locate the field in the Word document as
follows:
On Error GoTo Err_cmdWrd_Click
Dim objApp As Object
Dim txtA As TextBox 'this is txtbox in Access
Dim fldT As Field 'this is the field in the Word doc
Dim docW As Document
strDocName = "C:\TestWord"
Set txtA = txtPONo
Set objApp = CreateObject("Word.Application")
objApp.Visible = True
objApp.Documents.Open strDocName
Set docW = Word.Application.ActiveDocument
'Up to here no problems
'Next line is supposed to identify the field in the Word
document:
Set fldT = ????? 'and this is where I get stuck
'once I have identified the field I would like to
populate it like this:
fldT = txtA
Can this work, or is this nonsense??
Bakema