Subform output to word

  • Thread starter Mark C via AccessMonster.com
  • Start date
M

Mark C via AccessMonster.com

I have used this or a variation of it to export data to a word document....

I'll to give you an example that you can try
1. create a document in word called testDoc.Doc and insert this line
Trying to pass parameters to word from access ( in the end of this line
insert a book mark name MyFirstBookMark, using insert -> book mark)
2. Save the document on c:\
3. create a form in access with a text box and a button.
4. On the onclick event of the button insert the code
Dim wd As Word.Application
Dim myDoc As Word.Document

Set wd = New Word.Application
wd.Documents.Add "c:\testDoc.Doc"
Set myDoc = wd.ActiveDocument
With wd.Selection
.GoTo wdGoToBookmark, Name:="MyFirstBookMark" ' The name of the
book mark
.Font.Bold = True ' You can choose if bold
.Font.Underline = False ' or underline
.TypeText Text:= me.textFieldName ' insert values In it
End With
wd.Visible = True

If that works then create your documents with all the bookmarks you want to
send

The question I have is how would I export a field from a subform that is
continuous to the same document in addition to these fields...

Example I have

first and last name on main form and then a sub form with creditor info...

creditor, account number and balance

There can be 1 to 25 of these records in the subform. I want all the records
in the subform to be put into the word doc. I can make the bookmarks, but
how do I tell it to send the records?

TIA for any help.
 

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

Top