?
Solved

Access 2003 - sending a body of an email with a report?

Posted on 2006-11-01
7
Medium Priority
?
295 Views
Last Modified: 2008-03-10
Hi All,

I have an email system set up with my access reports that works fine but I wan to add in a long letter to the body of the email not as an attachment like the report is at the moment.

So at the moment this is how it is:

'set variables
                sMsgSubject = "1MthAfter"
                sMsgBody = "Dear Licensee Representative:" & Chr(13) & "Please see attached 1MthAfter not at the endlin"    
                DoCmd.OpenReport "1MthAfter", acPreview                              
                'DoCmd.SendObject acSendReport, "1MthAfter", cSNPFormat, rstReportDetails![Email], , , sMsgSubject, sMsgBody, False

The aove works fine if what I have to say in the body of the email isn't too long. But when I run out of space along that line and have to go to another line that is where to problems start to happen.
So I tried something like this but it gave me errors:


sMsgBody = "Dear Licensee Representative:" & Chr(13) & "Please see attached 1MthAfter when i came to the end of "   
sMsgBody  = sMsgBody & " the line and i continued with the body of the email on this line but it made no difference"      


When I ran the report and went to email it, It only email the first line as the body and not both lines? Can anyone help? How so I email the full body in an email that I hard code into the code.

Thanks again
                               
0
Comment
Question by:sabrina_spillane
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 9

Expert Comment

by:mpmccarthy
ID: 17853970
Change to ...

sMsgBody = "Dear Licensee Representative:" & vbCrLf & "Please see attached 1MthAfter when i came to the end of "
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 17854097
you could also store your full body text into a table inside a memo field, then pull the whole thing in with a DLookup. That way you don't have to hard code it into the text...just change the words anytime you want in the memo field.

J
0
 

Author Comment

by:sabrina_spillane
ID: 17858457
I can't just have the sMsgBody like that because what i want to say goes over multiple lines in the VBA. That is my problem I run out of space in the one line and i need to go to the next line. So just one sMsgBody won't work as I need to continue to the next line. Do you know what I mean.

sMsgBody = "Dear Licensee Representative:" & vbCrLf & "Please see attached 1MthAfter when i came to the end of  and I continue on here till the end of the line and then i run of off space and i need to continue to this line but if i have nothing in the begining of the line it will throw an error."

Can anyone help.

I don't want to create another table in the database just for this.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:sabrina_spillane
ID: 17860543
Has anyone any other options on this matter, thanks.
0
 
LVL 9

Assisted Solution

by:mpmccarthy
mpmccarthy earned 200 total points
ID: 17861132
sMsgBody = "Dear Licensee Representative:" & vbCrLf & "Please see attached 1MthAfter when i came to the end of  and I continue on here till the end of the line and then i run of off space and i need to continue to this line but if i have nothing in the begining of the line it will throw an error."

I don't understand.  All vbCrLf will do is create a line down.  How is this throwing an error?  You can put as many of them as you want in a string body.
0
 
LVL 34

Accepted Solution

by:
jefftwilley earned 800 total points
ID: 17861274
This worked fine

    Dim sMsgBody As String
    sMsgBody = "Dear Licensee Representative:" & Chr(13) & "Please see attached 1MthAfter when i came to the end of "
    sMsgBody = sMsgBody & " the line and i continued with the body of the email on this line but it made no difference"


What e-mail program are you using? Check your settings, and make sure you're sending HTML as an output format.

J
0
 

Author Comment

by:sabrina_spillane
ID: 17862964
Hi all,

Thanks for the quick response believe it or not the following worked even though I had tried that before hand and it through an error but thankfully it is working now. I must have been missing something.

Dim sMsgBody As String
    sMsgBody = "Dear Licensee Representative:" & Chr(13) & "Please see attached 1MthAfter when i came to the end of "
    sMsgBody = sMsgBody & " the line and i continued with the body of the email on this line but it made no difference"

Thanks again
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question