Dim oWord As Word.Application
    Dim oDoc As Word.Document
    Dim oTable As Word.Table
    Dim x As Integer


    Set oWord = CreateObject("Word.Application")
    oWord.Visible = True
    Set oDoc = oWord.Documents.Add

    Set rs = New ADODB.Recordset
    With rs
        .Open "SELECT * FROM ClientTable", cn, 2, 3

        Dim r As Integer, c As Integer
        Set oTable = oDoc.Tables.Add(oDoc.Bookmarks("\endofdoc").Range, rs.RecordCount, 5)
        oTable.Range.ParagraphFormat.SpaceAfter = 6

        'For r = 1 To rs.RecordCount
        Do While Not .EOF

            For c = 1 To 5
                oTable.Cell(r, c).Range.Text = rs(x).Value
                x = x + 1

            Next

        .MoveNext
        Loop
        'Next

        oTable.Rows(1).Range.Font.Bold = True

    End With
    Unload Me

It only displays the first row, and the font is not bold. Please help.

another problem is, ID field is not displaying, primary and auto inc,

Hi,

Try Changing thr for loop:

For c = 1 To 5
    oTable.Cell(r, c).Range.Text = rs(c-1).Value
Next

Also, change the Query To:

"SELECT * FROM ClientTable Order By ID"

change FieldName accordingly..

Regards
Veena

For r = 1 To rs.RecordCount
    For c = 1 To 5
        oTable.Cell(r, c).Range.Text = rs(c - 1).Value
    Next
.MoveNext
Next

this works fine, thanks a lot, but how can i enable all the table lines,

This question has already been answered. Start a new discussion instead.