Solved

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

Posted on 2006-11-01
7
292 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

696 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