Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Phillip Vong Phillip Vong is offline
external usenet poster
 
Posts: 3
Default Merge with SQL 2000 using Query instead of just a table.

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!


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Merge with SQL 2000 using Query instead of just a table.

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

"Phillip Vong" phillip_vong*at*yahoo*dot*com wrote in message
...
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!



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Phillip Vong Phillip Vong is offline
external usenet poster
 
Posts: 3
Default Merge with SQL 2000 using Query instead of just a table.

That's perfect! Thanks! I'll use Views.

Phil




"Peter Jamieson" wrote in message
...
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

"Phillip Vong" phillip_vong*at*yahoo*dot*com wrote in message
...
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!





Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Office 2000 Query and Autotext SameOld Microsoft Word Help 2 March 21st 06 10:57 PM
Office 2000 Query and Autotext SameOld Microsoft Word Help 2 March 16th 06 06:29 AM
mail merge from word to a query in Access both 2003worked in 2000 MrsNic Mailmerge 1 October 11th 05 07:00 PM
Office 2000-SP3 - Mail Merge- Query- Sort Records tab grayed out bjhow Mailmerge 0 September 27th 05 01:51 AM
Access 2000 mail merge from a conditional query Rich S. Mailmerge 0 August 31st 05 02:51 PM


All times are GMT +1. The time now is 06:43 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"