I'm updating an application from 2000 to 2003. I've read that 2003 doesn't
use DDE. Upon Microsoft's suggestion in a knowledge article I tried both
SQLStatement:="QUERY Select * From Docs;"
and
Connection:="TABLE [Docs]", _
SubType:=wdMergeSubTypeWord2000
as clauses in my OpenDataSource. Neither had any impact. I was still
prompted for a table name.
Any suggestions?
Thanks
Word 2003 /can/ use DDE but it now uses OLEDB by default.
Assuming you are connecting to Access, for DDE you will probably need:
yourMailMergeObject.OpenDataSource _
Name:="the full pathname of your .mdb", _
Connection:="TABLE Docs", _
SQlStatement:="SELECT * FROM Docs", _
SubType:=wdMergeSubTypeWord2000
In this case you can probably get away with either
yourMailMergeObject.OpenDataSource _
Name:="the full pathname of your .mdb", _
SQlStatement:="SELECT * FROM Docs", _
SubType:=wdMergeSubTypeWord2000
or
yourMailMergeObject.OpenDataSource _
Name:="the full pathname of your .mdb", _
Connection:="TABLE Docs", _
SubType:=wdMergeSubTypeWord2000
As far as I know, you only need the [] around the table name if it contains
characters such as spaces, but it is probably sensible to put them in.
Peter Jamieson
> I'm updating an application from 2000 to 2003. I've read that 2003 doesn't
> use DDE. Upon Microsoft's suggestion in a knowledge article I tried both
[quoted text clipped - 6 lines]
> Any suggestions?
> Thanks
Don Petersen - 10 Mar 2005 20:46 GMT
I would prefer to not use DDE. However, I tried both solutions, as I tried
to indicate in my first post.
This was to accommodate the new linkage:
doc.MailMerge.OpenDataSource _
Name:=Path & "IPdb.mdb", _
ConfirmConversions:=False, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
SQLStatement:="QUERY Select * From [Docs];"
and this was to use compatibility mode:
doc.MailMerge.OpenDataSource _
Name:=Path & "IPdb.mdb", _
ConfirmConversions:=False, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
Connection:="TABLE [Docs]", _
SubType:=wdMergeSubTypeWord2000
I even tried putting both clauses into compatibility mode:
doc.MailMerge.OpenDataSource _
Name:=Path & "IPdb.mdb", _
ConfirmConversions:=False, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
Connection:="TABLE [Docs]", _
SQLStatement:="QUERY Select * From [Docs];", _
SubType:=wdMergeSubTypeWord2000
I'm still getting prompted for a table.
Peter Jamieson - 11 Mar 2005 01:11 GMT
You (still) need to eliminate the word "QUERY" from your SQLStatement. For
OLEDB,
doc.MailMerge.OpenDataSource _
Name:=Path & "IPdb.mdb", _
SQLStatement:="Select * From [Docs];"
should be enough, and you do need the [] in this case.
Peter Jamieson
>I would prefer to not use DDE. However, I tried both solutions, as I tried
> to indicate in my first post.
[quoted text clipped - 23 lines]
>
> I'm still getting prompted for a table.
Don Petersen - 11 Mar 2005 19:06 GMT
I've tried about every syntactic variation on the SQLStatement clause. Some
result in a run-time error. Some result in a prompt for a table name. None
result in the datasource being opened and automagically pointing to the
proper table.