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

Mailmerge problems - how to solve?

P: n/a
Hi All,

I made an access Application which uses mailmerge function. I have a query
which I use to mailmerge to a word document. I created the word document as
a new document and I saved onto the computer.
Then, I have a form with a button which runs the query and opens the word
document

The code which is linked to the button is:

************************************************** ****
Private Sub btnMailMerge_Click()
On Error GoTo Err_btnMailMerge_Click

Dim oApp As Object, SourseFile As String
Dim strDocName As String
Dim strQueryName As String
Dim strUpdateQueryName As String
Dim db As Database
Dim qdf As QueryDef

Set db = CurrentDb
Set oApp = CreateObject("Word.Application")
Set qdf = db.QueryDefs("qryClearSelectedForMailout")
qdf.Execute dbFailOnError

'removed some code which is not related with my problem

Set qdf = db.QueryDefs(strUpdateQueryName)
qdf.Parameters("cboBrandPar") = cboBrand
qdf.Parameters("DTPickerPar") = DTPicker
qdf.Execute dbFailOnError

strDocName = "C:/Documents/CustMailMerge.doc"

Dim rs As DAO.Recordset
Set qdf = db.QueryDefs("qrySelectedForMailout")
'qdf.SQL =
Set rs = qdf.OpenRecordset()

If rs.EOF Then
MsgBox "There are no records to be printed out"
Else
oApp.Visible = True
oApp.Application.Documents.Open strDocName
End If
Set oApp = Nothing

Exit_btnMailMerge_Click:
Exit Sub

Err_btnMailMerge_Click:
MsgBox Err.Description
Resume Exit_btnMailMerge_Click
End Sub
*************************************************

Now, my problem is that the code works perfectly on my computer, but when I
move it to the customer's computer it doesn't do the mail merge.
The word document opens but the mailmerge toolbar is inactive.
The operations I do onsite are to relink the front end database application
to the back end one. Then I change the path to the document in my VBA code.
I also select the query with the records to be merged and link it to my
document.
I am not sure if there are some security problems, or some Access versions
which are different. The customer has MS Access 2002 (10.6501.6626) SP3 and
I have an older version of Access 2002.
Did anybody experienced such a problem? Any advice greatly appreciated.
Regards,
Nicolae


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


P: n/a
HI All,

For those who might be interested, I solved the problem. It was all due to a
warning about running an SQL command. When I was opening the word document
by itself, a pop-up windows was coming and it was asking "do you want to run
the SQL command ..."
I had to add a new key in the registry, as indicated in this article:

http://support.microsoft.com?kbid=825765

Regards,
Nicolae

Now, my problem is that the code works perfectly on my computer, but when I move it to the customer's computer it doesn't do the mail merge.
The word document opens but the mailmerge toolbar is inactive.
The operations I do onsite are to relink the front end database application to the back end one. Then I change the path to the document in my VBA code. I also select the query with the records to be merged and link it to my
document.
I am not sure if there are some security problems, or some Access versions
which are different. The customer has MS Access 2002 (10.6501.6626) SP3 and I have an older version of Access 2002.
Did anybody experienced such a problem? Any advice greatly appreciated.
Regards,
Nicolae


Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.