Mail Merge Macros

J

jonmarcr

We wrote macros to link up to one of four "mail queues" derived from our
access database. In Office 97 and then in Office 2000 they worked well but
in office 2003 we simply cannot get them to work properly.

The old syntax was:

Sub Merge1Q()
'
' Merge_1 Macro
' Macro recorded 08/05/2004 by Jon Marc
'
ActiveDocument.MailMerge.DataSource.QueryString = _
"SELECT * FROM [Qry-MAILSHOT ADDRESSES] WHERE (([Mail_Merge_1] =
-1))" & _
""
End Sub

This now gives us run time error 4198

The data source for this user is: MAIL MERGE DATA (JMR) Qry-MAILSHOT
ADDRESSES (in "My data sources" folder)

(each user has his own sub-table and so another user will have MAIL MERGE
DATA (PEC) Qry-MAILSHOT ADDRESSES and so on.

Within each table there are all the addresses selected for the 4 possible
mailshots and by manually selecting queue=-1 for either 1,2,3 or 4 we can get
it to work. However we simply want a macro to do this for us to avoid
errors.

Can anyone help please?
 
K

Karen Hart

Every MSAccess data source I had from 97 was named something.txt. I had to
change them all to something.doc for the merges to work after upgrading to
Access XP.
Hope that helps.
Karen Hart
 
P

Peter Jamieson

Assuming that you are not seeing a problem that has the same cause and
solution as is described in the following article:

http://support.microsoft.com/default.aspx?scid=kb;en-us;825765

I would

a. ensure that Word can "see" the query "Qry-MAILSHOT ADDRESSES" when you
try to connect to the data source manually. The problem is that the old
connection method used by default in Word 2000 and earlier (DDE) let Word
use most queries. The new default (OLEDB) excludes a number of types of
query. You can revert to DDE by checking Word Tools|Options|General|COnfirm
conversions at open and going through the connection process again, or using
the parameter Subtype:=wdMergeSubtypeWord2000 in your OpenDataSource call.
You might also need to use that parameter if you were opening the data
source using ODBC.
b. try changing the query syntax to use a table alias, e.g. something like

SELECT q.* FROM [Qry-MAILSHOT ADDRESSES] q WHERE ((q.[Mail_Merge_1] =

Peter Jamieson
jonmarcr said:
We wrote macros to link up to one of four "mail queues" derived from our
access database. In Office 97 and then in Office 2000 they worked well
but
in office 2003 we simply cannot get them to work properly.

The old syntax was:

Sub Merge1Q()
'
' Merge_1 Macro
' Macro recorded 08/05/2004 by Jon Marc
'
ActiveDocument.MailMerge.DataSource.QueryString = _
"SELECT * FROM [Qry-MAILSHOT ADDRESSES] WHERE (([Mail_Merge_1] =
-1))" & _
""
End Sub

This now gives us run time error 4198

The data source for this user is: MAIL MERGE DATA (JMR) Qry-MAILSHOT
ADDRESSES (in "My data sources" folder)

(each user has his own sub-table and so another user will have MAIL MERGE
DATA (PEC) Qry-MAILSHOT ADDRESSES and so on.

Within each table there are all the addresses selected for the 4 possible
mailshots and by manually selecting queue=-1 for either 1,2,3 or 4 we can
get
it to work. However we simply want a macro to do this for us to avoid
errors.

Can anyone help please?
 

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