SteveL13
asked on
How avoid error message when not sending email
I have the following code on an onclick event of an email hyperlink in a form.
But if the user closes the email window and doesn't send an email we get an error:
"The sendobject action was cancelled"
How can we not get this error message?
Private Sub txtEmail_Click()
Dim strEmail As String
If IsNull(Me.txtEmail) Then
MsgBox ("There is no email address shown")
Exit Sub
ElseIf Me.txtEmail = " " Then
MsgBox ("There is no email address shown")
Exit Sub
End If
strEmail = Me.txtEmail
DoCmd.SendObject , , , strEmail, , , , , True
End Sub
But if the user closes the email window and doesn't send an email we get an error:
"The sendobject action was cancelled"
How can we not get this error message?
Was your intent to have an email sent when someone clicks the txtEmail control?
ASKER
Yes. But when the email window opens and if the user changes their mind and doesn't send an email the error appears.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That did it. Thanks.