Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / April 2007

Tip: Looking for answers? Try searching our database.

Merge with SQL 2000 using Query instead of just a table.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Phillip Vong - 09 Apr 2007 19:44 GMT
Using Word 2003 and SQL 2000

Anyone know if it's possible to merge with SQL 2000 using queries versus
just one table?  Currently, I can only merge with one table in SQL and I
would like to merge with multiple tables using a Query.

Thanks!
Peter Jamieson - 09 Apr 2007 20:48 GMT
Do you mean Microsoft SQL Server 2000?

You can either
a. create a View in SQL Server and use that as the data source or
b. use Word VBA and set ActiveDocument.MailMerge.DataSource.QueryString to
be the Transact-SQL query you want, as long as Word is already connected to
the necessary database and the connection string will still work for the new
query
c. use Word VBA and its OpenDataSource method to issue a Transact-SQL
query, e.g. if you are connecting from Word 2002 or later using OLE DB, you
will probably be connnecting via a .odc file, in which case you can do
something like:

ActiveDocument.MailMerge.OpenDataSource _
 Name:="the pathname of your .odc", _
 Connection:="", _
 SQLStatement:="your SQL query"

d. If you have MS Access, create a database and link to the tables you need
to query, then create a query in Access and use that as the data source. NB,
there may well be performance consequences if you do things that way.

Peter Jamieson

> Using Word 2003 and SQL 2000
>
[quoted text clipped - 3 lines]
>
> Thanks!
Phillip Vong - 09 Apr 2007 21:06 GMT
That's perfect!  Thanks!  I'll use Views.

Phil

> Do you mean Microsoft SQL Server 2000?
>
[quoted text clipped - 28 lines]
>>
>> Thanks!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.