I would need to export a main form and subform (the subform is a datasheet with multiple entries) to a word template. The main form exports fine by using bookmarks. However, I'm struggling with exporting all the records from the subform instead of just the last one. I suspect the answer is in the recordset of the subform(?) but I have not been able to figure this out so far. Therefore, any pointers on this would be greatly appreciated.
A sample of the code used below:
[FONT=PrimaSans BT,Verdana,sans-serif]
[/FONT]
A sample of the code used below:
Code:
Private Sub cmdWord_Click()
On Error GoTo ErrorHandler
Dim oWord As New Word.Application
With oWord
.Documents.Add "Template.dot"
.Selection.GoTo wdGoToBookmark, , , "bmk1"
.Selection.TypeText Me.CustomerID.Value
.Selection.GoTo wdGoToBookmark, , , "bmk2"
.Selection.TypeText Me.CustomerName.Value
.Selection.GoTo wdGoToBookmark, , , "bmk3"
.Selection.TypeText Me.Date.Value
.Visible = True
End With
...
[/FONT]
Last edited: