Dougalsworld
Paul
- Local time
- Today, 09:24
- Joined
- Jul 29, 2005
- Messages
- 62
Hi Folks
I have searched and searched on this forum and the web for a solution, so far to no avail.
I basically need to send on the click of a button a mail independently to several people (1 email per person)
Now I have a way to do this using a loop function using recordsets and the SendObject function...
...problem is I need to add voting buttons to this email, and this method is not compatable with this, instead if I want voting buttons i need to send the mails using the Outlook.MailItem function, but I don't know how to loop this function to send multiple emails.
My MailItem code is below, does anyone know how I can ammend it to send multiple emails from a query "qry_Mail_Booking" ???
Dim outobj As Outlook.Application
Dim outappt As Outlook.MailItem
Dim stDocName As String
Set outobj = CreateObject("outlook.Application")
Set outappt = outobj.CreateItem(olMailtItem)
With outappt
.To = [LMEmail]
.Subject = [Subject]
.MeetingStatus = olMailItem
.Recipients.ResolveAll
.Display
.Send
.Save
End With
End If
' Release the Outlook object variable.
Set outobj = Nothing
' Set the AddedToOutlook flag, save the record, display a message.
Me!ReqSent = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
stDocName = "ADD_Booking_New"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit Sub
AddAppt_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
DoCmd.SetWarnings False
Me.Refresh
Many Thanks
I have searched and searched on this forum and the web for a solution, so far to no avail.
I basically need to send on the click of a button a mail independently to several people (1 email per person)
Now I have a way to do this using a loop function using recordsets and the SendObject function...
...problem is I need to add voting buttons to this email, and this method is not compatable with this, instead if I want voting buttons i need to send the mails using the Outlook.MailItem function, but I don't know how to loop this function to send multiple emails.
My MailItem code is below, does anyone know how I can ammend it to send multiple emails from a query "qry_Mail_Booking" ???
Dim outobj As Outlook.Application
Dim outappt As Outlook.MailItem
Dim stDocName As String
Set outobj = CreateObject("outlook.Application")
Set outappt = outobj.CreateItem(olMailtItem)
With outappt
.To = [LMEmail]
.Subject = [Subject]
.MeetingStatus = olMailItem
.Recipients.ResolveAll
.Display
.Send
.Save
End With
End If
' Release the Outlook object variable.
Set outobj = Nothing
' Set the AddedToOutlook flag, save the record, display a message.
Me!ReqSent = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
stDocName = "ADD_Booking_New"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit Sub
AddAppt_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
DoCmd.SetWarnings False
Me.Refresh
Many Thanks
Last edited: