[AccessD] error after converting (mailmerge)

MartyConnelly martyconnelly at shaw.ca
Wed Jan 14 17:13:25 CST 2004


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





More information about the AccessD mailing list