Solved

Access 2003 - sendObject Issues in VBA

Posted on 2006-11-14
2
499 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
[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
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

762 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