Paul:
The following is sample vbcode which may shed some insight on the task of which you are trying to create.
This code simply creates one email based on the users who have access. To have a procedure that sends multiple email attachments to multiple users is an easy task but requires a little bit more code. I do have that written but without the attachment piece. If you would like me to post it let me know.
’ Module : mdOutlook
’ Description: Send management reports via business rules ’ Procedures : GotoMsg
’ Created : 08/17/1999 John Sullivan
’ Modified :
’ 09/10/1999
’ -------------------------------------------------- Option Compare Database
Option Explicit
Public Function GotoMsg(Optional varAttachmentPath)
’ Comments :
’ Parameters : varAttachmentPath -
’ Returns : -
’ Created :
’ Modified :
’
’ -------------------------------------------------------- On Error GoTo PROC_ERR
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient Dim objOutlookAttach As Outlook.Attachment Dim dbsODB As Database
Dim rstOST As Recordset
Dim strTSASUB As String
Dim strTSAMsg As String
Dim strDateHolder As String
strDateHolder = InputBox(“Please Enter the date of the Work Item Meeting”, “Input Required”, “July 27”)
strTSASUB = “Work Item Ranking”
strTSAMsg = "Attached are the work item ranking lists for the monthly ranking meeting on Tuesday, " & strDateHolder & “, from 3:00 to 4:00 p.m., in room 5A5-1. These reflect the updates from last month’s ranking session. Please review and be prepared to discuss any changes needed.” & vbCrLf & vbCrLf
Set dbsODB = CurrentDb()
Set rstOST = dbsODB.OpenRecordset(“qryNotification”, dbOpenSnapshot)
Set objOutlook = CreateObject(“Outlook.Application”) Set objOutlookMsg = objOutlook.CreateItem(olMailItem) With objOutlookMsg
Do While Not rstOST.EOF
Set objOutlookRecip = .Recipients.Add(rstOST![Name]) If rstOST![Type] = “To” Then
objOutlookRecip.Type = olTo
Else
objOutlookRecip.Type = olCC
End If
rstOST.MoveNext
Loop
objOutlookRecip.Resolve
.Subject = strTSASUB
.Body = strTSAMsg
.Importance = olImportanceHigh
Set objOutlookAttach = .Attachments.Add(“c:\rptranking.rtf”) Set objOutlookAttach = .Attachments.Add(“c:\rptDescriptions.rtf”) Set objOutlookAttach = .Attachments.Add(“c:\rptSponsors.rtf”) objOutlookRecip.Resolve
.Display
End With
Set objOutlook = Nothing
rstOST.Close
'MsgBox (“Email Messages Created!”)
Exit Function
PROC_ERR:
MsgBox "The following error occured: " & Error$ Resume Next
End Function
Listserv Archives (BOB member since 2002-06-25)