Solved

Access 2003 - sendObject Issues in VBA

Posted on 2006-11-14
2
497 Views
Last Modified: 2008-01-09
Hi All,

I am using the SendObject in my VBA code to sent an email with an attachment but what i am having a problem with is the email that i have to insert. all the email are showing up correctly but when it goes to send it give me the following error:
"Run time Error :'2295'
"Unknown message recipient(s); the message was not sent"

Here below is the line for the SendObject - I think the issue is with the BBC section of it. I have three email in here, two which are within the company and a third which i get from a query that is poulated within the code and it is working because i am stepping through the code and i have it outputting to a message box before it goes into the SendObject method.

DoCmd.SendObject acSendReport, "1MthPriorReminder", cSNPFormat, rstReportDetails![Email], rstReportDetails![Email2], "sspillane@yahoo.com; lisa@abc.org" & rstCTRDetails![CTREmail], sMsgSubject, sMsgBody, False


this is where i think i am having the issue:
"sspillane@yahoo.com; lisa@abc.org" & rstCTRDetails![CTREmail],
The "rstCTRDetails![CTREmail]" is populated by a query and i need to have it with in the BBC section. What is the correct syntax to add this. I already tried a semi colon but that gave me the same error also.

Any ideas, thanks.
0
Comment
Question by:sabrina_spillane
  • 2
2 Comments
 
LVL 11

Accepted Solution

by:
fanopoe earned 250 total points
ID: 17941698
you need a semicolon between your hard coded one and your dynamic one:
"sspillane@yahoo.com; lisa@abc.org; " & rstCTRDetails![CTREmail]......

you might also use the nz function in the case of nulls in your recordset, you would know better than I if you have any:
"sspillane@yahoo.com; lisa@abc.org; " & nz(rstCTRDetails![CTREmail], "")......


HTH

0
 
LVL 11

Expert Comment

by:fanopoe
ID: 17941731
missed you comment about the semicolon. definitely try NZ, but you will surely need the semi colon too.

also, trap the error

on error goto errEmail


your code here


errEmail:
debug.print sspillane@yahoo.com; lisa@abc.org; " & nz(rstCTRDetails![CTREmail], "")
resume next

that way you can see the textual representation of what youa re trying to do.


HTH2
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 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