Roy-Vidar,
Any ideas about this? I've tried three different ways and can't get the list from the recordset to populate the email body. Email comes through fine, but just with the sentence.
Try One:
Dim rs As DAO.Recordset
Dim vArray As Variant
Dim strTo As String
Dim strCC As String
Dim strSubject As String
Dim strMsg As String
Dim intI As Integer, intJ As Integer
Dim strFileName As String
strFileName = "f:\users\janetb\fhc" & Format$(Date, "mm-dd-yy") & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "qryFHCxlsRpt", strFileName, True, ""
Set rs = CurrentDb.OpenRecordset("Select REGULAR-MD from qryFHCxlsRpt")
rs.MoveLast
vArray = rs.GetRows
strMsg = "Detailed summary report for the following docs:" & vbCrLf
For intI = 0 To UBound(vArray, 0)
strMsg = strMsg & vArray(intI)
Next intI
strTo = "janetb@mtn.ncahec.org"
strSubject = "FHC text"
strCC = ""
DoCmd.SendObject acSendReport, "Family Practice Service Detailed Report", "Snapshot Format", strTo, strCC, , strSubject, strMsg, False
rs.Close
Try Two:
Dim db As Database
Dim rs As Recordset
Dim data As Variant
Dim strTo As String
Dim strCC As String
Dim strSubject As String
Dim strMsg As String
strMsg = "Detailed summary report for the following docs:" & vbCrLf
Set db = OpenDatabase("f:\users\janetb\listXP.mdb")
Set rs = db.OpenRecordset("Select REGULAR-MD from qryFHCxlsRpt")
Set data = rs.GetRows(0)
strMsg = strMsg & data
strTo = "janetb@mtn.ncahec.org"
strSubject = "FHC text"
strCC = ""
DoCmd.SendObject acSendReport, "Family Practice Service Detailed Report", "Snapshot Format", strTo, strCC, , strSubject, strMsg, False
rs.Close
db.Close
Try Three:
Dim rs As DAO.Recordset
Dim vArray As Variant
Dim strTo As String
Dim strCC As String
Dim strSubject As String
Dim strMsg As String
Set rs = CurrentDb.OpenRecordset("Select REGULAR-MD from qryFHCxlsRpt")
rs.MoveLast
vArray = rs.GetRows
strMsg = "Detailed summary report for the following docs:" & vbCrLf
strMsg = strMsg & Join(vArray)
strTo = "janetb@mtn.ncahec.org"
strSubject = "FHC text"
strCC = ""
DoCmd.SendObject acSendReport, "Family Practice Service Detailed Report", "Snapshot Format", strTo, strCC, , strSubject, strMsg, False
rs.Close