Solved

Access 2003 - sendObject Issues in VBA

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
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…
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.

760 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

21 Experts available now in Live!

Get 1:1 Help Now