Hi,
I have an MS Access db which contains 2 queries.
What I want to do is to automatic generate a word document, which contains:
"A TITLE"
"results of query1:"
query1 (formated as a table)
"result of query2:"
query2 (formated as a table)
I searched on EE, and I came up with:
http://www.experts-exchange.com/Database/Miscellaneous/Q_20752299.html?sfQueryTermInfo=1+acc+tabl+wordBut unfortunately I couldn't figure it out how to do it (links seems to be broken)
This is what I've got so far, after clicking a command button:
Private Sub btn_Click()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim i As Integer
Set wrdApp = CreateObject("Word.Applica
tion")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add
With wrdDoc
.Content.InsertAfter "A TITLE"
.Content.InsertParagraphAf
ter
.Content.InsertAfter "results of query1:"
.Content.InsertParagraphAf
ter
' here should be the code to insert the results of query1 as a table
.Content.InsertAfter "results of query2:"
.Content.InsertParagraphAf
ter
' here should be the code to insert the results of query2 as a table
End With
Set wrdDoc = Nothing
Set wrdApp = Nothing
End Sub
Thanks for your time
Bart
Start Free Trial