Hi i have a script that creates an email for a booking when i click on the artist name which works great. i want to be able to subject the email with the week number of the month. ie in subject it would be WEEK 1 JULY WEEKEND CHECKOFF. with the date info coming from gigdate field
the email format generated is as follows
Code:
Private Sub artist(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 street As String
Dim commision As String
strEmail = "michelle@work.com.au"
strSubject = "Weekend Booking Checkoff "
strBody = "<h2><b>Please confirm your upcoming 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")
street = Me.street
suburb = Me.suburb
actfee = Format(Me.actfee, "00.00")
commission = Format(Me.commission, "00.00")
netpay = Format(Me.netpay, "00.00")
paid = Me.actpayment
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.artist & 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 = gigdate & " " & strSubject & " - " & act
.HTMLBody = strBody & "<p>" & "<p>" & act & "<br>" & gigdate & "<br>" & venue & "<br>" & street & ", " & suburb & "<br>" & start & " - " & finish & "<br>" & "Act Fee: $" & actfee & " Less Commission: $" & commission & " Net Pay: $" & netpay & "<p>" & "Payment Details: " & paid & "<p>" & "Please reply OK to confirm this booking"
.Save
' .Send
blnCreated = True
End With
End If
If blnCreated Then
Else
msgTxt = MsgBox("Email Failed.", vbOKOnly, "")
End If
DoCmd.Hourglass False
End Sub
the email format generated is as follows
Please confirm your upcoming weekend Booking
NAME OF ACT
Friday 20 July 2012
NAME OF VENUE
ADDRESS OF VENUE
09:30 pm - 01:00 am
Act Fee: $800.00 Less Commission: $80 Net Pay: $720.00
Payment Details: Invoice venue prior - EFT
Please reply OK to confirm this booking