I have a field that contains an email address and a command button that will bring up a new Outlook email and autofill the receipient in the "To" block. Easy enough, no prob.
If there is no data in txtEmail, the error message pops up as expected, but immediately upon closing the msgbox, a new Outlook message comes up autofilled with the last successful email.
I'm guessing
would bring a syntax error, so I'm hoping that y'all will take a look at my code and guide me toward the light. I am stymied, stumped even. Thanks in advance my VBA brothers and sisters, and peace!
If there is no data in txtEmail, the error message pops up as expected, but immediately upon closing the msgbox, a new Outlook message comes up autofilled with the last successful email.
I'm guessing
Code:
DoCmd.StopFrigginDoingThat!
Code:
Private Sub cmdSendEmail_Click()
Dim mailadd As String
Dim add As String
If IsNull(txtEmail) = True Then
Err_cmdSendEmail_Click:
MsgBox "Email address not found. To send the employee email, enter an email address and save the record.", vbOKOnly + vbExclamation, "Error"
Exit Sub
Else
mailadd = txtEmail
add = "mailto:" & mailadd
Me!cmdSendEmail.HyperlinkAddress = add
End If
End Sub