I'm not sure exactly what sort of output you are looking for or how your code looks (it might help if you posted your code here) but I have a couple mail merge features I use regularly and they work beautifully. I don't have to close any dialogue boxes. I took the advice of some other, more talented, Access dBase administrators and I generate a .txt document and then use that as my merge record source. It may seem like a needless step but it really helped me out. I'll post some examples of this code below.
Here is the code I use to generate the .txt file:
Code:
' Defining our file paths and other constants
ID= Me.ID.Value ' how we find the record we want in the Query table
Name= Me.Name '
docName = Name & " " & Format(Date, "mm-dd-yyyy") & ".txt" ' name of txt file for mail merge
Sourcename = "YOUR_FILEPATH_HERE" & docName ' full file name with path
strSQL = "SELECT * FROM [TABLE] WHERE [ID] = " & ID& ";" ' Selecting just a single record from the general query
' Committing this record to the query.
' This could mean the form will go to a different record that the one we are trying to generate
' documents for but that wont matter as we already have the IDnumber for the record we want
Me.Requery
DoCmd.GoToRecord , "", acLast
NewQ:
' Generating specific query for this participant. This query and the document it creates will be used
' for generating the Memo
Set qd = New DAO.QueryDef
qd.SQL = strSQL
qd.Name = "MailMerge"
CurrentDb.QueryDefs.Append qd
'Exporting this query as a basic text file
DoCmd.TransferText acExportDelim, , "MailMerge", Sourcename, True
'Cleaning up our query
CurrentDb.QueryDefs.Delete "MailMerge"
qd.Close
Set qd = Nothing
And then the actual Mail Merge:
Code:
Sub myMerge(Sourcename, strMonth, strMemoPath, lName)
Dim temp1 As String, W As Word.Application, Wtemp As Word.Document
' Opening Word and merging the data for Memo
temp1 = "FilePath\Memo Template - Accessish.dot"
Set W = CreateObject("Word.Application")
W.Visible = True
Set Wtemp = W.Documents.Open(temp1)
Wtemp.MailMerge.OpenDataSource Sourcename, , , , False
Wtemp.MailMerge.ViewMailMergeFieldCodes = wdToggle
' This part of the code copies the merged document info into a new document
' This is intended to allow transimssion of the document without retaining
' the connection to the original data source.
Wtemp.Select
W.Selection.WholeStory
W.Selection.Copy
W.Documents.Add , , wdNewBlankDocument, True
W.Selection.PasteAndFormat wdFormatOriginalFormatting
W.ActiveDocument.SaveAs2 strMemoPath & lName & " Memo " & strMonth & " " & Year(Date) & ".docx", _
wdFormatXMLDocument, False, "", True, "", False, False, False, False, False, 14
'W.ActiveDocument.Close
Wtemp.Close wdDoNotSaveChanges
Set Wtemp = Nothing
strMemoPath = ""
End Sub
I hope this helps or at least gives you an idea of some things to try out.