Word merge code - A Kallal

G

Guest

I have been using this code for a while with Office 2000. I recently moved
to Office 2003 and when you click on "OK Merge to Word" MS Word does open up
but with a blank document. In other word the merge failed. Does anyone know
what changes need to be made for Ofiice 2003 and this code.

Thanks
 
G

Guest

Hi Eric

I have just looked at Alberts RunWord module and if it opens word ok then it
would seem (I may be wrong) that the problem is not with the code. Have you
you moved the location of the word docs ? It is prob the onclick action (or
other event) you are using.

Try this - Create a button on you form (call it cboWord)

Private Sub cboWord_Click()
Me.Requery
Dim strSql As String
strSql = "select * from InertQueryNameHere where PrimaryFeldInQuery = " &
Me!ContolNameHoldingPrimaryField
MergeAllWord strSql, "LocationOfWordFiles"
End Sub

Change these in the code above
InertQueryNameHere
PrimaryFeldInQuery
ContolNameHoldingPrimaryField
LocationOfWordFiles

With the above I assume you are basing your form on a query. If your are
using a table then - InertQueryNameHere - would be InertTableNameHere

Note if you have multiple locations for your word docs (so that you can
merge different letters from different forms - or even different letters from
the same form using different buttons - or more likely an option group) -
LocationOfWordFiles - is the name of the folder holding these word docs.
Looking at Albert excelent code you would need this method or you will hve a
complete list of word docs each time you "click" and this could be a "very"
big list.



Hope this helps
 
A

Albert D. Kallal

Try downloading the word merge again.

Simply delete the two forms, and the two modules. Now, simply re-import them
into your application.

The two forms, and modules to (delete) and then import are outline here:

http://www.members.shaw.ca/AlbertKallal/wordmerge/page2.html

You can find the word merge here.
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

Note in the above, I do mention a update to the merge code.
on feb 14,2004

Do note, that for as long as I can remember, the ms-word document will open
up empty if you do not have any merge fields. I think even access 97 (very
old) did this. So, check your template, and make sure it has at least ONE
MERGE field in it, else you get a blank screen.
 

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