Dim siar As Integer, siac As Integer
            Set SIATable = SIADoc.Tables.Add(SIADoc.Bookmarks("\endofdoc").Range, rs.RecordCount, 7)
            SIATable.Range.ParagraphFormat.SpaceAfter = 0
            SIATable.Range.Font.Underline = wdUnderlineNone
            SIADoc.Tables(1).Borders(wdBorderTop).LineStyle = wdLineStyleSingle
            SIADoc.Tables(1).Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
            SIADoc.Tables(1).Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
            SIADoc.Tables(1).Borders(wdBorderRight).LineStyle = wdLineStyleSingle
            SIADoc.Tables(1).Borders(wdBorderHorizontal).LineStyle = wdLineStyleSingle
            SIADoc.Tables(1).Borders(wdBorderVertical).LineStyle = wdLineStyleSingle

            For siar = 1 To rs.RecordCount
                For siac = 1 To 7
                    SIATable.Cell(siar, siac).Range.Text = rs(siac - 1).Value
                    SIATable.Rows(siar).Range.Font.Size = 9
                    SIATable.Rows(siar).Range.Font.Bold = False
                Next
                .MoveNext
            Next

where can i put table headers, this code will loop on selected record on the table
how can i add date and time on the filename: SIADoc.SaveAs ("C:\Users\2mhzbrain\Desktop\Main Inventory - '"& DATE + TIME &"'.docx") this is not working, but this is what i want to happen on the file names. thanks

where can i put table headers, this code will loop on selected record on the table

Just add one row when you create a table.
Set SIATable = SIADoc.Tables.Add(SIADoc.Bookmarks("\endofdoc").Range, rs.RecordCount + 1, 7)

Fill first row with Column name before you get a data thorugh the looping.

        '....

        ' heading
        SIATable.Cell(0, 1).Range.Text = "Column 1"
        SIATable.Cell(0, 2).Range.Text = "Column 2"
        SIATable.Cell(0, 3).Range.Text = "Column 3"
        SIATable.Cell(0, 4).Range.Text = "Column 4"
        SIATable.Cell(0, 5).Range.Text = "Column 5"
        SIATable.Cell(0, 6).Range.Text = "Column 6"
        SIATable.Cell(0, 7).Range.Text = "Column 7"

        ' Fill other rows with data from database
        For siar = 2 To rs.RecordCount + 1
            siac = 1 To 7
                SIATable.Cell(siar, siac).Range.Text = rs(siac - 1).Value
                SIATable.Rows(siar).Range.Font.Size = 9
                SIATable.Rows(siar).Range.Font.Bold = False
            Next
        .MoveNext
        Next

how can i add date and time on the filename: SIADoc.SaveAs ("C:\Users\2mhzbrain\Desktop\Main Inventory - '"& DATE + TIME &"'.docx") this is not working, but this is what i want to happen on the file names. thanks

You can't do it with date and time.
Date and Time will return illegal string for file name.
Date = 4/2/2013
TIme = 12:36:53 PM
Windows will reject this character: \/:*?"<>

commented: Nice. +2

thank you for useful info

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.