Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
trev trev is offline
external usenet poster
 
Posts: 9
Default Mail Merge office 2003 from SQL Database

Cross-posted to Word Programming

I am working for a client on SQL Server 2000. They have an urgent
requirement regarding Mail Merge and I simply do not have the knowledge to
help. Here is the problem as sent to me, can anyone assist (apparently it
worked fine from ASP with Office 2000) :

I am looking for someone to solve the problem described under 'Requirement'
below:

Database: SQL 2000
Contains 2 tables with data:
TableA: contains all the data
TableB: contains 2 fields: Field1: Unique Identifier to line in TableA
Field2: Staff Number
Staff select records to be mail merged using a search and select process
through our Intranet. Their selection list is recorded in TableB. This Table
is then joined to TableA for the merge (ie in a View)

Requirement:

To mail merge the selection list against their staff number into Word 2003
using a selected template (we could end up with several different template
layouts).

Several staff could be using the system at the same time.

I need this to be as automated as possible. Staff using the system should
not have to go through the mail merge system currently offered in Word 2003.
Ideally they should be able to select a template, click on it, type in their
staff number and then the mail merge should be automatic from that point to
delivering the result in Word.

The mail-merge also needs to deal with a couple of conditional if
statements, based on a confidential indicator (values 0 €“ 4), two fields can
either be shown or not dependant of the Indicator value.

Pointers or assistance greatly appreciated.

TIA
Trev


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mail Merge office 2003 from SQL Database

Broadly speaking it should be possible to do this in much the same way that
it worked with Office 2000. The document and the query should be the same or
similar, but
a. Word nowpops up an additional question when you open a mail merge
document that is already attached to its data source. If you are opening the
document programmatically, the equivalent is that Word may fail to open the
data source if you have not made a modification to the user's Windows
Registry (in this case, the "user" could be ASP.NET, depending on what
you're doing) - see

http://support.microsoft.com/kb/825765/en-us

b. If you are attaching the data source programmatically using Word's
OpenDataSource method (this is likely, but it is also possible that the
document has been saved with the data source attached) then you will
probably need to modify the code a bit. With WOrd 2000 you would have been
using ODBC to connect to SQL Server and you would have had something like

objDocument.MailMerge.OpenDataSource _
Name:="", _
Connection:="DSN=name of the SQL Server DSN;other connection info;", _
SQLStatement:="SELECT * FROM whatever"

or possibly

objDocument.MailMerge.OpenDataSource _
Name:="pathname of a dsn file.dsn", _
Connection:="FILEDSN=pathname of a dsn file.dsn;other connection info;", _
SQLStatement:="SELECT * FROM whatever"

in Word 2003 you will almost certainly need to add an extra parameter,

Subtype:=wdMergeSubtypeWord2000

FWIW in Word 2003 the default connection method has changed from ODBC ato
OLE DB and you might want to change the OpenDataSource to reflect that. In
that case, you need a .udl file or .odc instead of that DSN, a different
connection string, and to alias the table names in the SELECT statement. (If
you search this group in Google groups for Peter Jamieson SQL Server SELECT
you may find some examples. The main advantage of using OLE DB is that it
deals with Unicode field types correctly.

There are other changes in the Word user interface that may affect what
users see and usabilty in general, but I suggest you start by getting the
connections to work.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Trev" wrote in message
...
Cross-posted to Word Programming

I am working for a client on SQL Server 2000. They have an urgent
requirement regarding Mail Merge and I simply do not have the knowledge
to
help. Here is the problem as sent to me, can anyone assist (apparently
it
worked fine from ASP with Office 2000) :

I am looking for someone to solve the problem described under
'Requirement'
below:

Database: SQL 2000
Contains 2 tables with data:
TableA: contains all the data
TableB: contains 2 fields: Field1: Unique Identifier to line in
TableA
Field2: Staff Number
Staff select records to be mail merged using a search and select process
through our Intranet. Their selection list is recorded in TableB. This
Table
is then joined to TableA for the merge (ie in a View)

Requirement:

To mail merge the selection list against their staff number into Word 2003
using a selected template (we could end up with several different template
layouts).

Several staff could be using the system at the same time.

I need this to be as automated as possible. Staff using the system should
not have to go through the mail merge system currently offered in Word
2003.
Ideally they should be able to select a template, click on it, type in
their
staff number and then the mail merge should be automatic from that point
to
delivering the result in Word.

The mail-merge also needs to deal with a couple of conditional if
statements, based on a confidential indicator (values 0 €“ 4), two fields
can
either be shown or not dependant of the Indicator value.

Pointers or assistance greatly appreciated.

TIA
Trev



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
Mail Merge in Office 2003 Ella Mailmerge 1 June 1st 07 05:51 AM
Mail Merge Word 2003 Excel 2003 database Gwendolyn Mailmerge 1 February 8th 06 02:59 PM
Word 2003 Mail Merge from Excel spreadsheet database Cockatiel's mom Mailmerge 1 January 2nd 06 04:44 AM
Mail merge Office 2003 gibijons Microsoft Word Help 0 November 23rd 05 05:51 PM
Editing Mail Merge Recipients using Excel 2003 database Michelle Mailmerge 1 February 9th 05 11:45 PM


All times are GMT +1. The time now is 09:54 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"