Mail Merge differences between 2000 and 2002

B

Bill S.

Hi,

Under Word 2000 the mail merge worked, but now that Office/Word 2002 has
been installed when the mail merge is executed, it brings up a 'Select
Table' dialog showing the list of tables within the database. There are two
problems with this dialog. The first is that it only allows one table to be
chosen (when there are two tables involved in the mail merge query), and
second the dialog is just not wanted! Does anybody have any ideas as to how
to resolve this problem?

Thanks for any help.
 
D

Doug Robbins - Word MVP

Word has only ever been able to use a single flat file as a data source. It
has never been able to use two tables.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
B

Bill S.

This is the code I've been using under 2000 for quite some time and it has
worked fine.

Query = _
"SELECT [Clients].[ClientsID], [Clients].[Last Name], " & _
"[Clients].[Active], [Retirement].* FROM [Clients],[Retirement] "

Query2 = _
"WHERE Retirement.[Balance Due] <> 0.0 AND " & _
"[Retirement].[Quarter] = '" & mShortQuarter & "' AND " & _
"[Clients].[ClientsID] = [Retirement].[LinkToParent] AND " & _
"[Clients].[Active] = 'Active' " & _
"ORDER BY [Clients].[Last Name]"

Dim M As Word.MailMerge
Set M = Wrd.Documents(1).MailMerge
M.MainDocumentType = wdFormLetters
M.Destination = wdSendToNewDocument
Call M.OpenDataSource(Name:=GetDbName(), sqlstatement:=Query,
sqlStatement1:=Query2)
Call M.Execute
 
D

Doug Robbins - Word MVP

Check out the OpenDataSource() function in the Visual Basic Help file.
There are probably more parameters that you need to specify due to
additional connection methods that were introduced in XP.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Bill S. said:
This is the code I've been using under 2000 for quite some time and it has
worked fine.

Query = _
"SELECT [Clients].[ClientsID], [Clients].[Last Name], " & _
"[Clients].[Active], [Retirement].* FROM [Clients],[Retirement] "

Query2 = _
"WHERE Retirement.[Balance Due] <> 0.0 AND " & _
"[Retirement].[Quarter] = '" & mShortQuarter & "' AND " & _
"[Clients].[ClientsID] = [Retirement].[LinkToParent] AND " & _
"[Clients].[Active] = 'Active' " & _
"ORDER BY [Clients].[Last Name]"

Dim M As Word.MailMerge
Set M = Wrd.Documents(1).MailMerge
M.MainDocumentType = wdFormLetters
M.Destination = wdSendToNewDocument
Call M.OpenDataSource(Name:=GetDbName(), sqlstatement:=Query,
sqlStatement1:=Query2)
Call M.Execute


Doug Robbins - Word MVP said:
Word has only ever been able to use a single flat file as a data source.
It has never been able to use two tables.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
P

Peter Jamieson

One thing you will almost certainly have to do is to follow the instructions
in this Knowledgebase article:
(The setting affects what happens when you open a data source in VBA as
well)

Peter Jamieson

Bill S. said:
This is the code I've been using under 2000 for quite some time and it has
worked fine.

Query = _
"SELECT [Clients].[ClientsID], [Clients].[Last Name], " & _
"[Clients].[Active], [Retirement].* FROM [Clients],[Retirement] "

Query2 = _
"WHERE Retirement.[Balance Due] <> 0.0 AND " & _
"[Retirement].[Quarter] = '" & mShortQuarter & "' AND " & _
"[Clients].[ClientsID] = [Retirement].[LinkToParent] AND " & _
"[Clients].[Active] = 'Active' " & _
"ORDER BY [Clients].[Last Name]"

Dim M As Word.MailMerge
Set M = Wrd.Documents(1).MailMerge
M.MainDocumentType = wdFormLetters
M.Destination = wdSendToNewDocument
Call M.OpenDataSource(Name:=GetDbName(), sqlstatement:=Query,
sqlStatement1:=Query2)
Call M.Execute


Doug Robbins - Word MVP said:
Word has only ever been able to use a single flat file as a data source.
It has never been able to use two tables.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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