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 / October 2004

Tip: Looking for answers? Try searching our database.

Stored proceedure with OLEDB ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael - 27 Sep 2004 19:23 GMT
Is there any way of persuading an OLEDB connection to accept a stored
proceedure for mail merge?

I'm trying to avoid storing any connection information on client machines
and really want to avoid creating a DSN on each machine.

Michael
cerullian - 28 Oct 2004 00:14 GMT
Here is some of my code that works with stored procedures:

With ActiveDocument.MailMerge
        .MainDocumentType = wdFormLetters

       .OpenDataSource Name:=strConnect, _
           SQLStatement:=strSQL
           
       .Destination = wdSendToNewDocument
       .Execute Pause:=False
   End With

(Here strConnect is the path & name of an ODC or UDL file containing
the connection string. ) To answer your question, strSQL would be
something like this:

    strSQL = "exec procMyStoredProc"

The exec part is necessary to make it work. You can append parameters
if needed.

Be aware that interoperability between Word and SQL Server just
sucks!! I wonder if anyone in the Word division has ever tried to use
it. One serious limitation is that your stored procedures must start
with the SELECT statement. You can't declare any variables, or do any
pre-processing; even SET NOCOUNT ON will cause it to fail.

cerullian

>Is there any way of persuading an OLEDB connection to accept a stored
>proceedure for mail merge?
[quoted text clipped - 3 lines]
>
>Michael
 
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.