Solved

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

Posted on 2006-11-01
7
284 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
  • 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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 50 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 200 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now