title: Mail merge started by VBA in Access let Word open Database again
body: <p>I'm working on a Access database which generates some mails with mail merge called from VBA code in the Access database. The problem is that if I open a new Word document and start the mail merge (VBA), Word opens the same Access database (which is already open) to get the data. Is there any way to prevent this? So that the already opened instance of the database is used?</p>
  
  <p>After some testing I get a strange behavior: If I open the Access database holding the SHIFT-Key the mail merge does not open an other Access instance of the same database. If I open the Access database without holding the key, I get the described behavior.</p>
  
  <p>My mail merge VBA code:</p>
  
  <pre><code>On Error GoTo ErrorHandler
  
      Dim word As word.Application
      Dim Form As word.Document
  
      Set word = CreateObject("Word.Application")
      Set Form = word.Documents.Open("tpl.doc")
  
      With word
          word.Visible = True
  
          With .ActiveDocument.MailMerge
              .MainDocumentType = wdMailingLabels
              .OpenDataSource Name:= CurrentProject.FullName, ConfirmConversions:=False, _
                  ReadOnly:=False, LinkToSource:=False, AddToRecentFiles:=False, _
                  PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
                  WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
                  SQLStatement:="[MY QUERY]", _
                  SQLStatement1:="", _
                  SubType:=wdMergeSubTypeWord2000, OpenExclusive:=False
              .Destination = wdSendToNewDocument
              .Execute
              .MainDocumentType = wdNotAMergeDocument
          End With
      End With
  
      Form.Close False
      Set Form = Nothing
  
      Set word = Nothing
  
  Exit_Error:
      Exit Sub
  ErrorHandler:
      word.Quit (False)
      Set word = Nothing
      ' ...
  End Sub
  </code></pre>
  
  <p>The whole thing is done with Access / Word 2003.</p>
  
  <p><strong>Update #1</strong>
  It would also help if someone could tell me what the exact difference is between opening Access with or without the SHIFT-Key. And if it is possible to write some VBA code to enable the "features" so if the database is opened without the SHIFT-Key, it at least "simulates" it.</p>
  
  <p>Cheers,
  Gregor</p>