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
 
C

Colin Coleman

Hi Ken,

Thanks for the reply, but im trying to get this routine to work as its
exactly what i need to do, because we have 187 different contract templates
at the moment and this number is growing weekly, all templates point back to
the "master" contracts database and i also let them select the contract type
so i can open Word template in edit so they can them.

Its just going to be a nighmare editing all the old documents for bookmarks
and also coupled with the fact that typing errors are more than likely to
bite the customers legal department later.

I did look at bookmarks but the client smiled then laughed and said...but
seriously , you gotta be joking....

Ill look at your link and see if i can get any help there...


Cheers

Colin
 
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

--
Mike Pippins

"We have met the enemy and he is us." -- Pogo Possum

Message posted via AccessMonster.com
 

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