[AccessD] error after converting (mailmerge)

pedro at plex.nl pedro at plex.nl
Wed Jan 14 15:08:38 CST 2004


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



More information about the AccessD mailing list