Getting data from Access to Word

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I'm quite a newbee, so please excuse me if I ask something that's very
obvious to you ;-)

Right now I've made a Word-template, in which data is retrieved from an
Access database using ADODB. The queries are defined in Word, and this is not
the best way.
Better would be if the Word-template uses queries defined in the Access
database, and that the Word template itself was called from within Access (by
a commandbutton on a form). Is there a way of doing this?

Another possibility could be that with a commandbutton_click, a new Word
document is made, based on the existing Word template; how would I do this?

BTW: I'm using Office XP.

Thanks in advance! Any help much appreciated!

Cheerio,

Fr@nk
 
Search the post "Export current record to word", there is an example how to
use word with bookmarks
==================================================
Create A word document, insert book marks where you want the value from
access should be insert, and then run this code

Public Sub PrintToWord()
Dim wd As Word.Application
Dim myDoc As Word.Document

Set wd = New Word.Application
wd.Documents.Add DOTpath & reportName & ".dot" ' The name and path
Set myDoc = wd.ActiveDocument
With wd.Selection
.GoTo wdGoToBookmark, Name:=BookMarkName ' The name of the book
mark
.Font.Bold = True ' You can choose if bold
.Font.Underline = False ' or underline
.TypeText Text:=ValueToInsertInTheBookMark ' insert values
End With
wd.Visible = True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top