OK, here's an easy one for you
Really, I know I've done this before, but I'm having a brain freeze...
I'm trying to fill in bookmarks in a set of word documents. There are several recordsets and (obviously) many fieldnames so I have the values in a table called tblSettlementDocFields. Here is my code. The problem is that mystr is a string, so it's putting the literal value into my document (e.g. myrs('PolicyNumber')) instead of the value (i.e. the actual policy number).
What type should mystr be?
'rsDoc is a recordset of the Doc IDs, there are 25 docs
Do While Not rsDoc.EOF
'get rs of bookmarks and fields for this doc
Set rsFields = mydb.OpenRecordset("select * from tblSettlementDocFields where fkDoc=" & rsDoc!ID & ";")
wrdApp.Documents.Open myPath & rsDoc!DocName
wrdApp.Visible = True
Do Until rsFields.EOF
Dim mystr As String
mystr = rsFields!RecordsetName & "('" & rsFields!FieldName & "')"
ActiveDocument.Bookmarks(rsFields!BookmarkName).Ra nge.Text = mystr
saveDoc = savePath & myrs!CaseNumber & "\" & rsDoc!DocName
'on error, create folder for case
On Error GoTo err1
'close this document, no save
'done, close word