Link to home
Start Free TrialLog in
Avatar of cgraziano
cgrazianoFlag for United States of America

asked on

MS Access 2007 / MS SharePoint problem with Outlook e-mail

I have recently split my MS Access database, with the backend being on SharePoint.  Everything seems to work really well.  Some minor issues, but no show stoppers.  Well, that's what I originally thought anyway.

Here's the problem:

I have a button on my MS Access form that takes the information from the fields on the Access form and creates a formatted e-mail message.  The VB code uses .HtmlBody for the body of the e-mail.  When I hit the button everything works perfectly.  The information is taken from the form and populated on to the Outlook e-mail just like it should; however, when I send the e-mail, all the data is stripped and left with some of the html formatting code.  It is very strange.  The information is there in the e-mail, but when I hit the send button, I look at the sent e-mail and the information is gone.

Even stranger is that the Subject line of the e-mail is unaffected.  It works perfectly fine.

If anyone has encountered this problem or can point me in the right direction I would be extremely thankful.
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

How are you creating the .HTMLBody string? You should try building a Variable and using that:

Dim sBody As String

sBody = WhateverMethodYouUseToBuildHTMLBody

Now use the sBody variable instead of .HTMLBody
Avatar of cgraziano

ASKER

Thanks for the suggestion.  Unfortunatley, I will not have access to my database until tomorrow morning.  I will try this out first thing.

One question though.  I used .HtmlBody because I needed the e-mail to be formatted with bolding and underlining.  Will I be able to accomplish that using the sBody string method you mentioned?

But, how does this explain Outlook stripping the e-mail of all the information?  Like I said, the e-mail is created with all the appropriate data and in the correct format, but is blank after being sent.  I originally thought it was a Outlook problem, but then started to think it may have something to do with the SharePoint permissions.  I used the same exact code before I split the database between Access and SharePoint and everything worked fine.  The problem didn't start until I started using SharePoint as the backend.

I was also just thinking about playing with Outlooks external editor settings under the e-mail options, mail formatter.  Maybe switching it to use MS Word as the default e-mail editor for all new e-mails.  Any thoughts?

Thanks
Ok.  I found out what the problem was.  It has soemthing to do with the HTML message formatter.  When I switch the e-mail to Rich Text it is sent perfectly.  So, then I went and changed the Mail Format for the MS Outlook 2007 inbox from HTML to Rich Text, but when I use my Access form to create the e-mail it changes the message format back to HTML.  I think since I am using the .HtmlBody in the VB code it is automatically converting it back to HTML.  Rather than relying on the user to change the message format for every message, I would like to create a way to have it done automatically.  I can think of only two options:

Change the .HtmlBody in the VB code.  I tried using the sBody method suggested by LMS but it did not like the html code code used in the body, and produced a blank message.  Instead of using .HtmlBody or .Body is there a rich text version I could use?

Or, is there a code I code put at the end of the e-mail code that will automatically convert the e-mail to Rich Text after the information has been added to the e-mail?

Any suggestions would be very helpful.  

Thank you  
I ended up using a .BodyFormat = olFormatRichText at the end of my e-mail code to switch the e-mail back to Rich Text.  I have to do a little more testing to ensure none of the formatting was lost, but initial indications look good.
ASKER CERTIFIED SOLUTION
Avatar of ee_auto
ee_auto

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial