Button to email record

A

albycindy

I have two buttons on my form (frmFirst). One to email the details entered on
the form to a set address(cmdCustomerCare) and another to email the details
to the email address entered(cmdEmailResp). Now - I have set them up exactly
the same (gone through the properties of the control to the OnClick event,
written the code there) and the first one(cmdCustomerCare) is working
beautifully but the
second one produces nothing. No email, no flickers, no error message. Why?
When they are practically the same? (posted below)

Private Sub cmdCustomerCare_Click()
On Error GoTo Err_cmdCustomerCare_Click

Dim Olk As Outlook.Application
Set Olk = CreateObject("Outlook.Application")

Dim OlkMsg As Outlook.MailItem
Set OlkMsg = Olk.CreateItem(olMailItem)

With OlkMsg

Dim OlkRecip As Outlook.Recipient
Set OlkRecip = .Recipients.Add("(e-mail address removed)")

OlkRecip.Type = olTo
..Subject = "Customer Care Follow Up CRD" & Me![pkCRDNumber]
..Send

End With

Set Olk = Nothing
Set OlkMsg = Nothing
Set OlkRecip = Nothing

Exit_cmdCustomerCare_Click:
Exit Sub

Err_cmdCustomerCare_Click:
MsgBox Err.Description
Resume Exit_cmdCustomerCare_Click

End Sub

****************************

Private Sub cmdEmailResp_Click()
On Error GoTo Err_cmdEmailResp_Click

Dim Olk As Outlook.Application
Set Olk = CreateObject("Outlook.Application")

Dim OlkMsg As Outlook.MailItem
Set OlkMsg = Olk.CreateItem(olMailItem)

With OlkMsg
..To = "mailto:" & Me![RespPersonEmail]
..Subject = "Message - Query to follow up"
..Body = "Please follow up on " & Me![pkCRDNumber]
..Send
End With

Set Olk = Nothing
Set OlkMsg = Nothing

Exit_cmdEmailResp_Click:
Exit Sub

Err_cmdEmailResp_Click:
MsgBox Err.Description
Resume Exit_cmdEmailResp_Click

End Sub

*****************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top