Both codes are listed below
--------------------------------------------------------
Private Sub SendMailButton_Click()
On Error GoTo ErrorHandler
Dim lngID As Long, strMail As String, strBodyMsg As String, _
blEditMail As Boolean, sndReport As String, strCompany As String
Dim msgPmt As String, msgBtns As Integer, msgTitle As String, msgResp As
Integer
Select Case Me.OpenArgs
Case "OwnerStatement"
sndReport = "rptOwnerPaymentMethod"
lngID = Nz(Me.cbOwnerName.Column(0), 0)
strMail = OwnerEmailAddress(lngID)
strBodyMsg = "Dear "
strBodyMsg = strBodyMsg & Nz(DLookup("[ClientTitle]",
"tblOwnerInfo", _
"[OwnerID]=" & lngID), " ") & " "
strBodyMsg = strBodyMsg & Nz(DLookup("[OwnerLastName]",
"tblOwnerInfo", _
"[OwnerID]=" & lngID), " Owner")
strBodyMsg = strBodyMsg & "," & Chr(10) & Chr(10) & Chr(13) _
& "Attached is your Statement for the period from " &
Format(Me.tbDateFrom, "d-mmm-yy") _
& " to " & Format(Me.tbDateTo, "d-mmm-yy") & "." _
& eMailSignature("Best Regards", True) & Chr(10) & Chr(10) _
& DownloadMessage("rtf")
DoCmd.SendObject acSendReport, sndReport, acFormatRTF, strMail,
, , "Your Statement", _
strBodyMsg, True
Case Else
Exit Sub
End Select
Exit Sub
ErrorHandler:
msgTitle = "Untrapped Error"
msgBtns = vbExclamation
If Err.Number = 2501 Then 'Prevent error when send is canceled
Err.Clear
Exit Sub
End If
MsgBox "Error Number: " & Err.Number & Chr(13) _
& "Description: " & Err.Description & Chr(13) & Chr(13) _
& "(frmBillStatement SendMailButton_Click)", msgBtns, msgTitle
End Sub
---------------------------------------------------------------------------------
Private Sub Report_Deactivate()
On Error GoTo Error_Handler
Dim lngID As Long, strMail As String, strBodyMsg As String, _
blEditMail As Boolean, dtInvDate As Date, varInvNum As Variant, _
idHorse As Long, strHorse As String
Dim msgPmt As String, msgBtns As Integer, msgTitle As String, msgResp
As Integer
If CurrentProject.AllForms("frmModify").IsLoaded = True Then
lngID = DLookup("OwnerID", "tblInvoice", "InvoiceID = " _
& Form_frmModify.lstModify.Column(0))
ElseIf CurrentProject.AllForms("frmModifyInvoiceClient").IsLoaded = True
Then
lngID = DLookup("OwnerID", "tblInvoice", "InvoiceID = " _
& Form_frmModifyInvoiceClient.lstModify.value)
Else
Exit Sub
End If
strMail = Nz(DLookup("Email", "tblOwnerInfo", "OwnerID = " & lngID), "")
If Not IsEmailOn Or Not IsOwnerWithEmail(lngID) Then
Exit Sub
End If
dtInvDate = Me.tbInvoiceDate
varInvNum = Me.tbInvoiceNumber
idHorse = Nz(Me.tbHorseID, 0)
If idHorse <> 0 Then
strHorse = Nz(DLookup("[HorseName]", "tblHorseInfo", "[HorseID]=" &
idHorse), "")
Else
strHorse = ""
End If
strBodyMsg = "Dear "
strBodyMsg = strBodyMsg & Nz(DLookup("[ClientTitle]", "tblOwnerInfo",
"[OwnerID]=" & lngID), " ") & " "
strBodyMsg = strBodyMsg & Nz(DLookup("[OwnerLastName]", "tblOwnerInfo",
"[OwnerID]=" & lngID), " Owner")
strBodyMsg = strBodyMsg & "," & Chr(10) & Chr(10) & Chr(13) _
& "Attached is your " & varInvNum & " Dated " & Format(dtInvDate,
"d-mmm-yyyy") _
& IIf(Len(strHorse) > 0, " for " & strHorse, "") & "." _
& eMailSignature("Best Regards", True) & Chr(10) & Chr(10) & Chr(13) _
& DownloadMessage("rtf")
If strMail = "Null" Or Len(strMail) = 0 Or _
DLookup("[MailFlag]", "tblAdminSetup") = False Then
Exit Sub
End If
DoCmd.SendObject acSendReport, Me.Name, acFormatRTF, strMail, , , "Your
Invoice", _
strBodyMsg, blEditMail
Exit Sub
If MsgBox("Do you want to send Email??", vbYesNo + vbDefaultButton2)
= vbYes Then
DoCmd.SendObject acSendReport, Me.Name, acFormatRTF,
strMail, , , _
"Your Invoice", strBodyMsg, True ' ** Change to "False"
later
End If
Exit Sub
Error_Handler:
Select Case Err.Number
Case 2501
Case 2487
Resume Next
Case Else
MsgBox "Error Number: " & Err.Number & Chr(13) _
& "Description: " & Err.Description, , "Untrapped Error"
End Select
End Sub
--
Thanks in advance for any help with this......Bob
WindowsXP..MS Access 2007
"Bob Vance" <rjv...@ihug.co.nz> wrote in message
news:ftrkfo$5tt$1...@lust.ihug.co.nz...
It was the first day of school.
As the principal made his rounds, he heard a terrible
commotion coming from one of the classrooms.
He rushed in and spotted one boy, taller than the others, who seemed to be making the most noise.
He seized the lad, dragged him to the hall, and told him to wait there until he was excused.
Returning to the classroom, the principal restored order and lectured the class for half an hour about the importance of good behavior.
"Now," he said, "are there any questions?"
One girl stood up timidly. " Please sir," she asked, "May we have our teacher back?"
* Pet products[/url:3hut95dt], dog bed[/url:3hut95dt], pet supply[/url:3hut95dt], Dog Collar[/url:3hut95dt], Dog Clothes[/ur (http://www.lovelonglong.co (http://www.lovelonglong.co (http://www.lovelonglong.co (http://www.lovelonglong.co (http://www.lovelonglong.com:3hut95dt)95dt)95dt)95dt)95dt)95dt] *
I believe that we are not real social workers. We may be doing social work in the eyes of the people, but we are really contemplatives in the heart of the world. For we are touching the body of Christ twenty-four hours 26And I think that in our family we don 19t need bombs and guns, to destroy, to bring peace, just get together, love one another, bring that peace, that joy, that strength of presence of each other in the home. And we will be able to overcome all the evil that is in the world.
Thsale is a professional, loyal and reliable wow gold supplier online, we pioneered selling cheap wow gold. Welcome to thsale buy world of warcraft gold Buy Cheap WoW Gold, World of Warcraft Gold, Please look here! We are a Great MMORPG company. wow money and wow items,which is very cheap WOW Gold�01All US Server 24.99$/1000G on sell! Cheap wow gold,rs powerleveling,wow power leveling,Buy Cheapest/Safe/Fast WoW US EU Gold Power leveling
------------------------------
White tea[/url:3glvqry1], Herbal Tea[/url:3glvqry1], Jasmine tea[/url:3glvqry1], Chinese Tea[/url:3glvqry1], Green Tea[/url:3 (http://www.tea-of-chinese.com/white-tea.html:3 (http://www.tea-of-chinese.com/herbal-tea.html:3 (http://www.tea-of-chinese.com/jasmine-tea.html:3 (http://www.tea-of-chinese.com/chinese-tea.html:3 (http://www.tea-of-chinese.com/green-tea.html:3glvqry1)1)1)1)1)1],