?
Solved

Access 2003 - sendObject Issues in VBA

Posted on 2006-11-14
2
Medium Priority
?
506 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 1000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

801 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