Email with no address error

Wayne Cramer

Registered User.
Local time
Today, 02:35
Joined
Aug 10, 2007
Messages
93
I have a form from which I send and Email to the responsible party for a task. The e-mail address is picked up from a fielsd in the form named Email and the VBA runs on an on click event from a button on the form. The only problem is when someone clicks the button but there is no email entry for the form and an error message appears. The code appears below. Is there any way to add error trapping to give the operator a message to select an e-mail recipient? The Me.Email_Sent line provides a check mark in a yes no field to shopw an e-mail was sent. Any suggestions will be greatly appreciated.

Me.Refresh
stText = "You have been assignerd a new Order Support Automation issue. See details in the attached spreadsheet below."

DoCmd.SendObject acSendQuery, "qryForEmail", acFormatXLS, Me.Email, , , ":: New Order Support Automated Response Issue ::", stText
Me.Email_Sent = True
 
B4 you send the object, check if the mail adress is empty.
Code:
if len(nz(me.Email,""))=0 then
  msgbox "Email Adress is empty dombo!",vbExclamation,"Mty email adress"
else
   docmd.sendobject ...
endif
 
Thanks Guus2005. This is exactly what I needed - though I took the liberty to exchange dombo with something more P.C. for my client.
 

Users who are viewing this thread

Back
Top Bottom