MartyConnelly
martyconnelly at shaw.ca
Tue Jan 20 23:13:29 CST 2004
Using everything with A2K format saves doing a Unicode to Ansi
conversion from 97.
A couple of other things to try
If it's Word 2000 or 97, try just setting the Name parameter to blank, i.e.
.OpenDataSource Name:="", _
etc. Word does not like it if you specify a name and a connection string
for ODBC calls.
If it's Word 2002 you will also need to add
Subtype:=wdMergeSubTypeWord2000
Also have a look at these examples
Super Easy Word Merge.
http://www.attcanada.net/~kallal.msn/msaccess/msaccess.html
or this Cindy Meister's MVP site
http://homepage.swissonline.ch/cindymeister/MergFram.htm
Pedro Janssen wrote:
>Thanks Marty for your response. I will try this when i am at work.
>
>I didn't convert the mdw file to A2k, but i could open the converted
>database with this mdw.
>How is this possible?
>
>Pedro Janssen
>
>
>
>----- Original Message -----
>From: "MartyConnelly" <martyconnelly at shaw.ca>
>To: "Access Developers discussion and problem solving"
><accessd at databaseadvisors.com>
>Sent: Thursday, January 15, 2004 12:13 AM
>Subject: Re: [AccessD] error after converting (mailmerge)
>
>
>
>
>>How about trying
>>strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
>> "Data Source=c:\somepath\mydb.mdb;" & _
>> "Jet OLEDB:System Database=MySystem.mdw", _
>> "myUsername", "myPassword"
>>Note, remember to convert both the MDB and the MDW to the 4.0
>>database format when using the 4.0 OLE DB Provider. Make a new copy of
>>97 mdw to handle 2000.
>>
>>
>>pedro at plex.nl wrote:
>>
>>
>>
>>>Hello Group,
>>>
>>>i converted a A97 secured database to A2K.
>>>After making the changes in Wrkgadmin.exe and the ODBC Data Sources, i
>>>
>>>
>changed the names in the module. After running the mailmerge i get an error:
>Run-time error '5922' Word was unable to open the data source. The debug
>selects the .OpenDataSource from the code below.
>
>
>>>I figure out why this error occurs.
>>>
>>>TIA
>>>
>>>Pedro Janssen
>>>
>>>
>>>
>>>
>>>Sub CreateMergeDoc(UseDDE As Boolean, PrintDoc As Boolean)
>>>
>>> Dim WordDoc As Word.Document
>>> Dim strLetter As String
>>> Dim strConnect As String
>>> Dim WordApp As Word.Application
>>>
>>> Set WordApp = CreateObject("Word.Application")
>>>
>>> Set WordDoc = WordApp.Documents.Add
>>> With WordDoc.MailMerge
>>> If UseDDE Then
>>> strConnect = "QUERY Uitvoer"
>>> Else
>>> strConnect = "DSN=MS Access 2000 " _
>>> & "Database;DBQ=E:\Cytologie\positieven\" _
>>> & "BeveiligdPOSITIEVEN(A2K).mdb;" _
>>> & "FIL=MS Access;"
>>> End If
>>> .OpenDataSource _
>>> Name:="E:\Cytologie\positieven\BeveiligdPOSITIEVEN(A2K).mdb", _
>>> ReadOnly:=True, LinkToSource:=True, _
>>> Connection:=strConnect, _
>>> SQLStatement:="SELECT * FROM [Uitvoer], [Aanvrager] WHERE
>>>
>>>
>Uitvoer.AanvragerID = Aanvrager.AanvragerID AND Uitvoer.ControleID = " &
>Forms![Brief]![veld] & ";"
>
>
>>> With Fields
>>> ...............
>>> End With
>>>
>>> With WordApp.Selection
>>> ...............
>>> End With
>>>
>>>
>>> With WordDoc.MailMerge
>>> .DataSource.FirstRecord = 1
>>>
>>> .Destination = wdSendToNewDocument
>>>
>>> .Execute
>>>
>>> If PrintDoc Then
>>> .Application.Options.PrintBackground = False
>>> .Application.ActiveDocument.PrintOut
>>> End If
>>> End With
>>>
>>> WordApp.Visible = True
>>> End With
>>>End Sub
>>>
>>>
>>>
>>>
>>>
>>>
>>--
>>Marty Connelly
>>Victoria, B.C.
>>Canada
>>
>>
>>
>>_______________________________________________
>>AccessD mailing list
>>AccessD at databaseadvisors.com
>>http://databaseadvisors.com/mailman/listinfo/accessd
>>Website: http://www.databaseadvisors.com
>>
>>
>>
>>
>
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com
>
>
>
--
Marty Connelly
Victoria, B.C.
Canada