Thanks Michael, I did try that, but it didn't work for me.
BUT....I got it to read the e-mail recipients names from a table, and assigned those names to a variable. My program now works! It creates a single e-mail, with multiple recipients and attaches multiple documents. Here is my modified code:
On Error GoTo Err_Handler
DoCmd.OutputTo acOutputReport, "Report1", acFormatRTF, "d:\Test1.doc"
DoCmd.OutputTo acOutputReport, "Report2", acFormatRTF, "d:\Test2.doc"
DoCmd.OutputTo acOutputReport, "Report3", acFormatRTF, "d:\Test3.doc"
Dim strTemp As String
Dim varAttach(2) As Variant
Dim strRecTo(1, 0) As String
Dim lngCount As Long
Dim varProxies As Variant
Dim cGW As GW
varAttach(0) = "d:\Test1.doc"
varAttach(1) = "d:\Test2.doc"
varAttach(2) = "d:\Test3.doc"
Dim dbs As Database, rst As Recordset, idx As Index
Dim tr As String, tb As String, stDocName As String
Dim dbs1 As Database
Set dbs1 = DBEngine.Workspaces(0).OpenDatabase("D:\TestDatabase\Test_be.mdb")
Set rst = dbs1.OpenRecordset("Tbl_E-mail")
rst.Index = "AccRpt"
With rst
Do While Not rst.EOF
tb = Nz(!AccRpt)
If tb = "zz" Then
Exit Do
Else
tr = tr & "; "
If tr = "; " Then
tr = ""
End If
End If
tr = tr & !AccRpt
rst.MoveNext
Loop
End With
dbs1.Close
strRecTo(0, 0) = tr
Set cGW = New GW
With cGW
.Login
.BodyText = "See the attached reports."
.Subject = "Reports"
.RecTo = strRecTo
.FileAttachments = varAttach
.FromText = ""
.Priority = "High"
strTemp = .CreateMessage
.ResolveRecipients strTemp
If IsArray(.NonResolved) Then MsgBox "Some unresolved recipients."
.SendMessage strTemp
.DeleteMessage strTemp, True
End With
Kill "d:\Test1.doc"
Kill "d:\Test2.doc"
Kill "d:\Test3.doc"
Exit_Here:
Set cGW = Nothing
Exit Sub
Err_Handler:
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical
Resume Exit_Here