Dim db As Database
Dim s As Recordset
Set db = CurrentDb
Set s = db.OpenRecordset("qry_merge")
If s.RecordCount = 0 Then
Dim rep
rep = MsgBox("No Records found!", vbExclamation)
Exit Sub
End If
Dim wd As New Word.Application, ltr As Word.Document
Set ltr = wd.Documents.Open("U:\BCC Macro\BCC4 CR CARD LETTER XP2.DOC", , , , , , , , , , , True)
wd.Visible = True
wd.ActiveDocument.MailMerge.OpenDataSource "U:\BCC Macro\VisionPLUS Macro.mdb", , , , False, , , , , , , "QUERY qry_merge", , , False
wd.ActiveDocument.MailMerge.Execute
ltr.MailMerge.MainDocumentType = wdNotAMergeDocument
ltr.Close True
db.Execute ("UPDATE TBL_MEMOS SET LETTER_BRANCH = TRUE WHERE MID(DATE_PROCESSED,1,10)='" & Mid(Forms!frm_date_report!List0.Value, 1, 10) & "'")
DoCmd.SetWarnings False
Echo True, "Merging Mail..."
wd.Visible = True
Set wd = Nothing