I'm not sure where to post this so I apologize in advance if it is in the wrong forum. I have a table that associates Word Bookmarks with the Field Names in the main Sales data table. The idea was to allow the end users to come up with their own reports in word using bookmarks and then associate the bookmarks with the field names in the Sales table. Then they could press a button and "by magic" the program would produce their new report nicely filled in with the correct data from the sales table.
The problem is that I can't figure out how to refer to the field name in the sales table (rstData) that is stored in the associations table (rstBookmark). Below is my latest attempt that failed miserably.
rstData.MoveFirst
Dim fldName As DAO.Field
Do While Not rstData.EOF 'stepping through the Sales records they selected
'fill the template table
rstBookmark.MoveFirst
Do While Not rstBookmark.EOF
Set fldName = rstBookmark!TableFieldName
'Update the bookmark with the data in rstData
'rstBookmark!WordBookmarkName has the name of the Bookmark
'rstBookmark!TableFieldName has the name of the Field that is in rstData
UpdateBookmark oDoc_TempTemplate, rstBookmark!WordBookmarkName, rstData!fldName
rstBookmark.MoveNext
Loop
'All the data has been written to the table
'copy the TempTemplate table
oDoc_TempTemplate.Tables(1).Range.Copy
'paste it into the Final Document
oSel_FinalDoc.Range.Paste
'move to the next Property
rstData.MoveNext
Loop