Question : using Access to create email message bounces back if user changes message body

I am using this code in an Access 2000 DB from a button on a form that will create an Outlook email message:

(Event Properties of the OnClick event for the 'SendEmailNow' button)

Dim objol As New Outlook.Application, rtfmail As MailItem
Set rtfmail = objol.CreateItem(olMailItem)
With rtfmail
.FormDescription.UseWordMail = True
.Display

.Subject = "Task ID" & [Forms]![Task]![TaskID]
.Body = "I just created Task ID" & [Forms]![Task]![TaskID] & " and need you to take a_
look at it and if you agree, please submit. Thank You."

End With
Set objol = Nothing
DoCmd.Close

(End of Code)

This is working as long as the sender does NOT change ANY portion of the body of the message. If the sender changes the message from:

I just created Task ID 234 and need you to take a look at it and if you agree, please submit. Thank You.

to:

I just created Task ID 234 and need you to take a look at it and if you agree, please submit. Thank You.

(ADDED) Oh, by the way, give me a call if you have any questions. Thanks again.

I will receive an Undeliverable message in Outlook from the System Administrator:

Your message did not reach some or all of the intended recipients.

      Subject:      Task ID 234
      Sent:      3/30/2005 12:00 PM

The following recipient(s) could not be reached:

      Recipient's name on 3/30/2005 12:00 PM
            Unable to deliver the message due to a recipient problem
            MSEXCH:MSExchangeIS:DOMAIN:SERVER

HOWEVER, if I rem out the lone statement .BODY = "XXX...", then what happens is that an email is created with no text in the body of the message, BUT the sender can add information AND the message will be sent successfully.

Also, another thing. IF I SAVE the message instead of sending it, I can go into Outlook, add any text to the message body and be able to send it with no problem. HHMMMM?!?!?

My options are:

A) not to allow the sender to be able to edit the body of the message
B) leave the message blank and let the sender complete it before sending
C) have the sender save the message, then go back in and edit the message before sending
D) leave my default message as is AND allow the sender to make changes/add info before sending

I would like to use option D, but if there is no resolution, I would default to option A.

any suggestions?

Thanks in advance.

Note: this database was originally written in Access version 97, but the code remained the same when converting to version 2000. Also have an XP version. All versions get the same results.








Answer : using Access to create email message bounces back if user changes message body

Oh yes, sorry, I missed it. Try this:

Dim objol As New Outlook.Application, rtfmail As MailItem
Set rtfmail = objol.CreateItem(olMailItem)
With rtfmail
.FormDescription.UseWordMail = True
.Subject = "Task ID" & [Forms]![Task]![TaskID]
.Body = "I just created Task ID" & [Forms]![Task]![TaskID] & " and need you to take a_
look at it and if you agree, please submit. Thank You."
.Save
.Display
End With
Set objol = Nothing
DoCmd.Close
Random Solutions  
 
programming4us programming4us