Send email from filtered data records

MichelleB

Registered User.
Local time
Tomorrow, 03:15
Joined
May 29, 2012
Messages
17
hi i need to be able to send an email from a filtered Form

the form shows all bookings for the next week, i need to be able to group by a name field and the email lists all the bookings for that name

any help please:eek:
 
hi i thought i would give some more info as i was very vague sorry.

i have a filtered list created with a date range that generates a form view.
i want to be able to on the generation of the form view create on the fly grouped emails from the records for each artist. so i they have two shows that weekend it will list both shows into the email

i can create a formatted email with the details from one booking only at the moment and need to group by the email field venue.email into the table that i have formatted into the email body:eek:

this is what i current have that is working for one - how do i add an IF Loop into this please

Code:
Private Sub act_DblClick(Cancel As Integer)
Dim msgTxt As Variant
Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem
Dim blnCreated As Boolean
Dim act As String
Dim venue As String
Dim start As String
Dim finish As String
Dim actfee As String
Dim netpay As String
Dim actpayment As String
Dim actcomment As String
Dim gigdate As String
Dim artist_email As String

strEmail = "me@here.com.au"
strSubject = "Weekend Booking Confirmation"
strBody = "<h2><b>Please confirm your weekend bookings</b></h2>"
act = Me.artist
gigdate = Format(Me.gigdate, "dddd dd mmmm yyyy")
venue = Me.venuename
start = Format(Me.start, "hh:nn am/pm")
finish = Format(Me.finish, "hh:nn am/pm")
artist_email = Me.artist_email

blnCreated = False

Set objOutlook = New Outlook.Application

If IsNull(Me.artist_email) = True Or Me.artist_email = "" Then
DoCmd.Hourglass False
msgTxt = MsgBox("Unable to create an email for " & Me.act & Chr(13) & "No email address listed in the database.", vbOKOnly + vbInformation, "")
Else
DoCmd.Hourglass True
Set objMailItem = objOutlook.CreateItem(olMailItem)

With objMailItem
.To = Me.artist_email
.CC = strEmail
.Subject = strSubject & " - " & act & " - " & gigdate
.HTMLBody = strBody & "<p>" & "<table border=1>" & "<tr>" & "<td>" & gigdate & "</td>" & "<td>" & act & "</td>" & "<td>" & venue & "</td>" & "<td>" & street & "</td>" & "<td>" & suburb & "</td>" & "<td>" & start & " - " & finish & "</td>" & "</tr>" & "</table>" 


.Save
' .Send
blnCreated = True
End With

End If



DoCmd.Hourglass False

End Sub
 

Users who are viewing this thread

Back
Top Bottom