Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SendObject email code issue

Posted on 2013-02-07
1
Medium Priority
?
269 Views
Last Modified: 2013-02-07
What is wrong with this code?

DoCmd.SendObject acSendReport, "rptJob", acFormatPDF, "txtEmail", , , "Leigh Transport From " & [txtFromCity] & " - " & [txtToCity]",& "See attached.  Best Regards Leigh Transport"
0
Comment
Question by:SteveL13
1 Comment
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 38865186
Your "To" argument is wrong. If you want to use the value in txtEmail as the To address, then remove the quotes around it.

You have an ampersand in FRONT of your Body section:

,& "See attached.  Best Regards Leigh Transport"

You don't need the ampersand.

Also, what are your "txt" objects? Are they Textboxes on your form, or are then Fields in the form's recordset?

After making the changes above if you're still having troubles, remove the square brackets:

DoCmd.SendObject acSendReport, "rptJob", acFormatPDF, txtEmail, , , "Leigh Transport From " & txtFromCity & " - " & txtToCity", "See attached.  Best Regards Leigh Transport"
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

876 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