Solved

SendObject email code issue

Posted on 2013-02-07
1
262 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
[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
1 Comment
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 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

Veeam gives away 10 full conference passes

Veeam is a VMworld 2017 US & Europe Platinum Sponsor. Enter the raffle to get the full conference pass. Pass includes the admission to all general and breakout sessions, VMware Hands-On Labs, Solutions Exchange, exclusive giveaways and the great VMworld Customer Appreciation Part

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

621 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