Solved

Access 2003 - sendObject Issues in VBA

Posted on 2006-11-14
2
502 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

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…
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.
Familiarize people with the process of utilizing SQL Server views 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 Access…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

732 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