
Sending Email to Distribution List
With outlook, it works best:
The sendobjject method of the docmd object works fine. You can use a group
assigned in outlook or pull the email addresses from a table in your
database. tbls, qrys work great, reports suck, you have to send it in *.rtf
format and you lose a lot of formatting. If your users could install some
freeware from microsoft, loook into the snapshot viewer option. It works
well
This is a routine I use just to give you the jist, it makes a table and
sends it as xls to a list of emails in a table in the db
************************CODE************************************************
Sub EmailAEBudgets()
Dim rs As Recordset
Dim fEmail As Field
Dim fLoc As Field
Dim fID As Field
Dim sSQL As String
Dim qdf As QueryDef
Dim dte As Date
Dim i As Integer
i = MsgBox("Do you want to send the AE Bugets?", vbYesNo + vbDefaultButton2,
"Send AE Budgets")
If i = vbNo Then Exit Sub
Set rs = CurrentDb.OpenRecordset("tblLocation")
Set fEmail = rs("LSM")
Set fLoc = rs("Location")
Set fID = rs("CorpID")
Set qdf = CurrentDb.CreateQueryDef("")
Do Until rs.EOF
sSQL = "SELECT tblLocation.Location, tblAEBudgets.FirstName,
tblAEBudgets.LastName, CCur(tblAEBudgets.Budget) as Budget, "
sSQL = sSQL & "tblAEBudgets.CorpID, GetLeague([tblAEBudgets]![Budget])
AS League INTO AEGrps "
sSQL = sSQL & "FROM tblLocation INNER JOIN tblAEBudgets ON
tblLocation.CorpID = tblAEBudgets.CorpID "
sSQL = sSQL & "WHERE tblAEBudgets.CorpID =" & fID & ";"
qdf.SQL = sSQL
qdf.Execute
dte = Format(Now(), "General Date")
DoCmd.SendObject acSendTable, "AEGrps", acFormatXLS, fEmail,
True
rs.MoveNext
DoCmd.DeleteObject acTable, "AEGrps"
Loop
MsgBox "Done"
End Sub
************************************************************
Quote:
>Is there a way to send a Access object(report, table etc) to a email
>distribution list? I want to use Access to mail to a group of addresses
>created after a query runs
>Ted Woodward