473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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

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
Else
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.AppShow
oWord.FileOpen Name:="c:\program files\access developer demo\ps.dot"

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

.viewpage
End With
End If
End Sub

Nov 12 '05 #1
1 2967
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:

http://www.attcanada.net/~kallal.msn.../msaccess.html

--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
ka****@msn.com
http://www.attcanada.net/~kallal.msn
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: intl04 | last post by:
Is it possible to create a Word form as the data entry form for an Access database? I didn't see any reference to this possibility in my Access books, so I'm sorry if this is a question that is...
2
by: Shannon Rotz | last post by:
I have a function in a Microsoft Access module (below) which creates a Word XP Mailmerge document, drawing the data from Access XP. I can get the connection to work fine. However, when I create...
2
by: roz | last post by:
Hello, I'm fairly new to VB programming and I've been going round the bend with this problem, so any nudges or shoves in the right direction would be greatly appreciated. I have a template...
5
by: ruomingxu via AccessMonster.com | last post by:
I am new in this area. I want to use values in a Access database and pass them to a word document. I tried this test code in a form of the Access database but it didn't work (temp.doc is a word...
8
by: babyangel43 | last post by:
Hello, I have a query set up in Access. I run it monthly, changing "date of test". I would like this query to be merged with a Word document so that the cover letter is created in Word, the fields...
4
by: no8do | last post by:
Hi there, I am brand new in access and VBA programming and I am asking for your help. One of the fields in my db is of the OLE object data-type. I' ve written a vb script that is executed on a...
1
by: icthus123 | last post by:
I'm trying to open a word document from access and enter some data from my access form into the document. I've used this code: Dim objWord As Object Dim objDocument As Word.Document ...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
9
by: DeZZar | last post by:
Hi all, Basically I want the data in an open form to merge with a word template and create a new document. So a user navigates to a particular records and presses a button "Produce Document"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.