Exporting subform to word template

Katsku

New member
Local time
Yesterday, 20:00
Joined
Dec 9, 2009
Messages
4
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:

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=PrimaSans BT,Verdana,sans-serif]
[/FONT]
 
Last edited:
as an idea, you could concatenate the values in the columns of the subform into a string and use your function to add that concatenated string?
 

Users who are viewing this thread

Back
Top Bottom