By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,248 Members | 1,961 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,248 IT Pros & Developers. It's quick & easy.

How to pass data from a ms access form into a new Word document

P: n/a
Hello all,
I am a newbie to access.
I try to pass data from a form into a new Word document
Below you see how far I got ... can anybody help ?

Private Sub btnMaakbrief_Click()

If lGoon = False Then
' Here I check some of the controls to see if they contain required
data, if not a msgbox is displayed
Dim oWord As Object

' Declaration of the variables, actually there are a lot more, but I
wanted to keep this
'post a short as possible
Dim sNaamschrijver As String, sFunctiechrijver As String
Dim sTelefoonschrijver As String, sEmailschrijver As String

' Here the varialbles get their values from the form
sNaamschrijver = Nz(Trim(Me!txtNaamschrijver.Value))
sFunctiechrijver = Nz(Trim(Me!txtFunctiechrijver.Value))
sTelefoonschrijver = Nz(Trim(Me!txtTelefoonschrijver.Value))
sEmailschrijver = Nz(Trim(Me!txtEmailschrijver.Value))

' I am totally confused here ... could somebody give me help on
openig a new Word document, and then how to place these variables into a
specific line in the document ?

Set oWord = CreateObject("word.application")
oWord.FileOpen Name:="c:\program files\access developer demo\"

With oWord
'.filenew "c:\program files\access developer demo\"
Application.FollowHyperlink "c:\program files\access developer

End With
End If
End Sub

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
I have a nice working example of how to do this.

In fact, the example is designed to be placed into existing applications.
You can word enable any ms-access form with ONE line of code. The default is
to only merge the current record you are looking at.

Try my sample...and read the notes on how to use it:

Albert D. Kallal (MVP)
Edmonton, Alberta Canada
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.