It was recomended to me to use the CreateTableFromRecordset in order to get the line items on the subreport when they export to Word in a table instead of the tab format in which they get exported right now. I saw some code for this by searching the groups in google but am unsure where to put the code. Here is the code that I found:

Function CreateTableFromRecordset( _
rngAny As Word.Range, _
rstAny As ADODB.Recordset, _
Optional fIncludeFieldNames As Boolean = False) _
As Word.Table

' From Access 2000 Developer's Handbook, Volume I
' by Getz, Litwin, and Gilbert. (Sybex)
' Copyright 1999. All Rights Reserved.

Dim objTable As Word.Table
Dim fldAny As ADODB.Field
Dim varData As Variant
Dim strBookmark As String
Dim cfield As Long

' Get the data from the recordset
varData = rstAny.GetString()

' Create the table
With rngAny

' Creating the basic table is easy,
' just insert the tab-delimted text
' add convert it to a table
.InsertAfter varData
Set objTable = .ConvertToTable()

' Field names are more work since
' you must do them one at a time
If fIncludeFieldNames Then
With objTable

' Add a new row on top and make it a heading
.Rows.Add(.Rows(1)).HeadingFormat = True

' Iterate through the fields and add their
' names to the heading row
For Each fldAny In rstAny.Fields
cfield = cfield + 1
.Cell(1, cfield).Range.text = fldAny.Name
End With
End If
End With
Set CreateTableFromRecordset = objTable
End Function

Where do I insert this code? The fields that I will be using are: [Line Item], [Quantity], [ItemCode], [Description], (below description on a separate row would be [ItemComment]), [DUP], [Extension], and on the last row would be =Sum([Extension].

Can anyone help this beginner....