Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.sqlserver.server,microsoft.public.word.mailmerge.fields
Andrew Staley Andrew Staley is offline
external usenet poster
 
Posts: 1
Default Import SQL Data to Word/Export Data from Word to SQL?

Is it possible using Microsoft Word, SQL Server to create a document
template that will import data into mail merge fields. And then if the data
in that field is changed, for that change to be written back to the SQL
database?

Thanks in advance, Andrew.

  #2   Report Post  
Posted to microsoft.public.sqlserver.server,microsoft.public.word.mailmerge.fields
Uri Dimant Uri Dimant is offline
external usenet poster
 
Posts: 1
Default Import SQL Data to Word/Export Data from Word to SQL?

Andrew
Hmm, I think that is a good candidate for FILESTREAM in SQL Server 2008



"Andrew Staley" wrote in message
...
Is it possible using Microsoft Word, SQL Server to create a document
template that will import data into mail merge fields. And then if the
data in that field is changed, for that change to be written back to the
SQL database?

Thanks in advance, Andrew.



  #3   Report Post  
Posted to microsoft.public.sqlserver.server,microsoft.public.word.mailmerge.fields
Linchi Shea Linchi Shea is offline
external usenet poster
 
Posts: 1
Default Import SQL Data to Word/Export Data from Word to SQL?

Sure, it's possible. You can access/manipulate Word programatically through
its exposed API and access/manipulate SQL Server through any number of data
access APIs (e.g. .NET SqlClient) in the same program.

Linchi

"Andrew Staley" wrote:

Is it possible using Microsoft Word, SQL Server to create a document
template that will import data into mail merge fields. And then if the data
in that field is changed, for that change to be written back to the SQL
database?

Thanks in advance, Andrew.

  #4   Report Post  
Posted to microsoft.public.sqlserver.server,microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Import SQL Data to Word/Export Data from Word to SQL?

You can connect a Word 2002/2003/2007 Mail Merge Main document to a single
SQL Server data source using either ODBC or OLE DB - OLE DB is the default,
and essential if you have Unicode type text fields. However, unless
something has changed recently
a. you will only be able to connect to a Table or View, not a Stored Proc.
(actually, you can just about connect to a Table-valued function).
b. I am pretty sure you will need to be using Integrated (Windows)
Security.

You need a .odc which you would typically create starting from New Source...
button in the Select Data Source dialog in Word.

Word has a number of limitations that Excel does not appear to have when
accessing SQL Server data - for example, Word does not honour any SQL text
you put in the .odc. If you want to specify anything other than the basic
sorts/filters you can set up in the MailMerge Edit recipients dialog box,
you'll have to use Word's OpenDataSource method to specify the query, or use
a view. You ony get to use /one/ table/view; there's no parent/child stuff
in Word MailMerge out-of-the-box Mailmerge.

Incidentally, you can also use a Word DATABASE field to insert an entire
table without using MailMerge. This has other limitations and won't help you
post updates back to SQL Server.

What I can't tell you off the top of my head is whether you will be able to
edit source data in that scenario, using MailMerge Edit Recipients. I would
expect that you can as long as the data source allows it. It doesn't (can't)
impose any validation rules of its own so you would have to rely on SQL
Server constraints etc. for that.

Another approach if you are using Word 2007 is to use Content Controls
instead of merge fields and use the related Custom XML data as an
intermediary. You get to write all the code, probably in a .NET language,
but there are ome basic MS examples around and AIUI VSTO can do some of the
plumbing for you.

Peter Jamieson

"Andrew Staley" wrote in message
...
Is it possible using Microsoft Word, SQL Server to create a document
template that will import data into mail merge fields. And then if the
data in that field is changed, for that change to be written back to the
SQL database?

Thanks in advance, Andrew.


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
Export data from word to excel Teo Microsoft Word Help 2 January 9th 09 02:31 PM
How do I export data in Word form fields into either Excel or Acce shellyd Microsoft Word Help 1 March 20th 08 07:53 AM
Word Form Field data export shellyd Microsoft Word Help 2 March 18th 08 07:42 AM
How do I import a word data form into a works data base? pezfarm Microsoft Word Help 1 September 15th 06 10:13 AM
How do I export address data from MS Word to Outlook? Prazer53 Microsoft Word Help 0 April 13th 05 02:43 PM


All times are GMT +1. The time now is 03:34 PM.

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"