Generate Email with multiple records

MichelleB

Registered User.
Local time
Today, 14:22
Joined
May 29, 2012
Messages
17
Hi again, i have a script that generates an email for a booking html formatted. i need to be able to list more than one booking on the email

i want to me able to send out emails for all musicians that are working that weekend to confirm their bookings. i have a form that lists all bookings for a date period. some act have one booking some have three, i want to be able to click on a act name in field act and it generate an email with any and all bookings that are showing in the table for that act. so the email would look like below in a table

----------------------------------------------------------------------
Please Confirm your weekend booking

Friday 01 June 2012 Gian Bar Petite 07:00 pm - 10:00 pm $350
Saturday 02 June 2012 Gian Bar Ncle 07:00 pm - 10:00 pm $350

Please reply OK to confirm this booking

----------------------------------------------------------------------
is this possible to create?:banghead:

code i currently use to create the emails is
Code:
Private Sub Command235_Click()
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 street As String


strEmail = "me@gigs.com"
strSubject = "Weekend Confirmation - "
strBody = "<h2><b>Please Confirm your weekend booking </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")
actfee = Me.actfee
netpay = Me.netpay
commission = Me.commission
actpayment = Me.actpayment
taken = Me.takendate
street = Me.street
suburb = Me.venue_suburb



blnCreated = False

Set objOutlook = New Outlook.Application

If IsNull(Me.email) = True Or Me.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.email
.CC = strEmail
.Subject = strSubject & " " & act & " " & gigdate
.HTMLBody = strBody & "<p>" & "<p>" & act & "<br>" & gigdate & "<br>" & venue & "<br>" & street & ", " & suburb & "<br>" & start & " - " & finish & "<br>" & "$" & actfee & " less" & " $" & commission & " commission" & " =" & " $" & netpay & "<p>" & "Payment Details: " & actpayment & "<p>" & "Please reply OK to confirm this booking" & "<p>" 


.Save
' .Send
blnCreated = True
End With

End If

If blnCreated Then
msgTxt = MsgBox("Finished creating email. The email is in your Outlook 'Drafts' folder.", vbOKOnly, "")
Else
msgTxt = MsgBox("Email Failed.", vbOKOnly, "")
End If

DoCmd.Hourglass False
End Sub
 

Users who are viewing this thread

Back
Top Bottom