Doing a Word 2003 Mail Merge from Access 2003

C

Colin Coleman

Hi ,

I have everything in place from the access database side, i can select a
record, create a query in VB "ContractSelect" that contains one record that
i want Word 2003 to display as its datasource when it prints, but what
happens is that when ever i open/launch word from WITHIN Access 2003 it
always shows the last record data from the previous time i ran the program.

BUT if i start Word manually it says connect to SQL...blah and works
correctly.


The access datbase is called Contracts.mdb
The Query in the datbase is called ContractSelect
strDocName Contains the full path and filename for the word mailmerge doc

The code in Access to open word i have created is this:-


Sub OpenWordDoc(strDocName As String)
Dim objApp As Object
' Opens the document
Set objApp = CreateObject("Word.Application")
objApp.Visible = True
objApp.Documents.Open strDocName
' This next bit maybe complete crap....but i cant find any help on doing it
......
objApp.Documents(1).MailMerge.opendataSource _
Name:="C:\data\contracts.mdb", LinkToSource:=True _
, Connection:="QUERIES ContractSelect", SQLStatement:="SELECT * FROM
ContractSelect;"
' Execute the mail merge.
objApp.Documents(1).MailMerge.Execute
End Sub


using the above It opens the document but now comes up with the "data link
Properties box" Then the "Confirm data Source" dialog where I select MS
Access Datbases via DDE (*.mdb,*.mde), then i get an error saying "Word was
unable to open the data source."

Id very much appreciate it someone could help me with this begginers
question.

Thanks

Colin
 
A

Albert D. Kallal

I not really should why you get the "last time" reocrd.

However, I have working soltion that merges the current recrod, and it don't
create a query, and furhter does not allow word to attached to ms-access.

You can word enable ANY form you have with ONE LINE of code, and my system
will pull the one reocrd your are looking at, and launch word.

You can find this "super easy word merge" here:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
 
K

Ken Sheridan

Colin:

You might like to take a look at my demo of various Access to word
automation operations at:


http://community.netscape.com/n/pfx/forum.aspx?msg=23781.1&nav=messages&webtag=ws-msdevapps


As its just the one record you want to pass to Word I'd suggest using the
routine for inserting text at bookmarks in a Word template document rather
than executing a mail merge. The demo includes both, however, plus one or
two other things.

Ken Sheridan
Stafford, England
 
M

Mikal via AccessMonster.com

Colin Coleman wrote:
I did look at bookmarks but the client smiled then laughed and said...but
seriously , you gotta be joking....
[quoted text clipped - 61 lines]

Hi, Colin

Take a look at Mr. Kallal's site. Seriously.

Mike
 

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