Avatar of SteveL13
SteveL13
Flag for United States of America

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.

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

Open in new window


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?
Microsoft Access

Avatar of undefined
Last Comment
SteveL13

8/22/2022 - Mon