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 / January 2005

Tip: Looking for answers? Try searching our database.

OpenDataSource problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Phill - 28 Jan 2005 18:29 GMT
I have and Access 2003 (saved as Access 2000 format) database using Word 2003
to do a simple mail merge.  I get a message that says it couldn't open the
document.  When I try to manually do the merge, and test the connection, I
get a message saying "test connection failed because of an error in
initializing provider.  The database has been placed in a state by user
'Admin' ...that prevents it from being opened."  When I close my database
and
test the connection it works.  I've tried this several times with the same
results.  Any ideas?  Thanks.   Phill

Here is my code.

   Set WordDoc = GetObject(strFinalDoc, "Word.Document")
   WordDoc.Application.Visible = True
 
   WordDoc.MailMerge.OpenDataSource _
   Name:=CurrentDb.Name, _
   LinkToSource:=True, _
   ReadOnly:=True, _
   Connection:="TABLE tempMailMerge", _
   SQLStatement:="SELECT * FROM tempMailMerge"
   
   WordDoc.MailMerge.Execute




   
Peter Jamieson - 29 Jan 2005 08:58 GMT
I would guess the problem is as follows:
a. you already have the data base open
b. the Connection string is the string that you would have used in Word
2000 or earlier to open the database using DDE
c. however, the OpenDataSource code you are using will cause Word to try to
open the database using OLEDB, not DDE. OLEDB will not recognise this
connection string, either.
d. OLEDB probably tries to open the database in a sharing mode that is
incompatible with the mode it is already open in, and will fail.

Possible solutions:
e. modify the connection string to specify a mode that will work (not sure
this can actually work)
f. add the parameter

SubType:=wdMergeSubTypeWord2000

to your OpenDataSource call. This shouls make Word open the database using
DDE.

NB, you probably do not need either of these lines:

>    LinkToSource:=True, _
>    ReadOnly:=True, _

Peter Jamieson

> I have and Access 2003 (saved as Access 2000 format) database using Word
> 2003
[quoted text clipped - 20 lines]
>
>    WordDoc.MailMerge.Execute
 
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.