Solved

SendObject email code issue

Posted on 2013-02-07
1
219 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 84

Accepted Solution

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
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…

728 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

10 Experts available now in Live!

Get 1:1 Help Now