Hi All
 
The following code works fine if We write it in Excel/vba but if my frontend is Access and I want to write same type of code so that it passes a SQL statement to word document and then print the mail merge word document letters.
 
	
	
	
		
 
I hope anyone can point me in the right direction.
 
Thanks
 The following code works fine if We write it in Excel/vba but if my frontend is Access and I want to write same type of code so that it passes a SQL statement to word document and then print the mail merge word document letters.
		Code:
	
	
	Sub Merge_abc()
strWorkbookName = "J:\System.mdb"
With CreateObject("Word.Application").Documents.Add("J:\Letter1.doc").MailMerge
  .MainDocumentType = 0
  .destination = 1
  .OpenDataSource _
            Name:=strWorkbookName, _
            AddToRecentFiles:=False, _
            Revert:=False, _
            Format:=wdOpenFormatAuto, _
            Connection:="Data Source=" & strWorkbookName & ";Mode=Read", _
            SQLStatement:="SELECT * FROM `tblmaster` where Printpoolno='" & Textbox1.Value & "'"
  .Execute
   .Parent.Close 0
 End With
  MsgBox "The letters have been printed off"
 Exit Sub
 End If
	I hope anyone can point me in the right direction.
Thanks