Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendObject Macro - Access 2000 1

Status
Not open for further replies.

gethmyster

Technical User
Aug 31, 2004
3
GB
Hi - i need help!!!

I am trying to send different emails to lists of addresses depending on the criteria selected - which I have managed to do using the send object Macro (without an object) however when ran the marco which triggers the email macros if there are items on a quiery that match there criteria, it only send 1 email from the 1st marco it triggers, the other macros run but don't send.

I have run each macro indivisualy and once access has sent on email it won't send anymore - the macros run as form flash up on screen and when i place a msgbox in there it also pops up but not email is sent. I have to close access and reopen it but once again is sends one email then gives up.

Any ideas why it is limiting it like this??

Please help - if u need more info let me know.

Cheers

Lee
 
You need to loop thru the recordset returned by the query and send for each row

forget macros to do this, you need some VBA code



Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
yeah worked out looking throught the site VBA whould have been better, but too late now. The macros cycle through the records. the problem is run a macro it sends an email run it again ot don't nor do any of the others. Close access reopen it and run a macro it works again.

 
Hi

I have a very similar problem that I would like some advice on. I have used some VB code and the sendobject function to send a notification email (no attachment, just a title) and have the same problem, once one mail is sent, Access wont send any more without exiting the database and reopening.

Any suggestions?
 
There's a known flaw regarding the sendobject method of the docmd object SendObject method fails in Access 2000. In the Microsoft link, there's one workaround, else questions about e-mail has been answered numerous times in the different Access fora, here's a lengthy one describing both sendobject, and opening an instance of Outlook Thread702-396121.

Roy-Vidar
 
Hi all, managed to fix the problem, downloaded a fix from microsoft website which did the trick. Well impressed it was microsoft's programing that was wrong on millions an hour rather than me on a lot less got it right.
 
From a from in Access I am sending a report as an attachment via email to a distribution list that will be built each time the report is run based on a filter query - the distribution list can exceed over 100 email addresses. I am using MS Outlook 9.0 from MS Access 2000.

My first question is: Is there a specific email address format required? i.e. "Michelle.cole@businessname.com" vs. "Cole, Michelle". If the address is formatted as "michelle.cole@businessname.com; mcole@businessname.com; etc.", all is good. But if the address is formatted as "Cole, Michelle; Gray, Sabrina", I receive the following MS error msg, "Unknown Message Recipient(s); Message was not sent." If I go directly to Outlook, open a new mail message and plug in "Cole, Michelle; Gray, Sabrina" the message will send with no issue.

Here is my code:
*
*
Dim strTo 'The "To" recipients of the email message, separated by semicolon (;)
Dim strSubject 'The "Subject" line of the email message
Dim strText 'The "Text" of the email message

'Build the "To" distribution List...
'There will be a loop here to populate the variable, strTo. I am just testing for now.
'strTo = "Michelle.Cole@commercebank.com; mcole2@kc.rr.com" 'this format works!
strTo = "Cole, Michelle; Gray, Sabrina"

strSubject = "Subject Line Info"
strText = "Body of Email"

DoCmd.SendObject acReport, stDocName, "SnapshotFormat(*.snp)", strTo, "", "", strSubject, strText, False, ""
*
*

(I am using .snp because the report has lines, shading, etc. and this format holds these elements.) I don't want to plug in "True" and allow the user to Edit the Message in production, but when I did it temporarily to see what was being plugged into the recipient line of the email when I was using "Cole, Michelle; Gray, Sabrina" - "Cole; Michelle; Gray; Sabrina" was what populated in the Recipient line (notice that the commas were converted to semicolons) causing the error.

Question #2: Can I generate only one email and send it to multiple recipients at one time or do I have to generate a single email, send it to one recipient, loop to the next email address record, create another single email, send it to that recipient, and so on until I get to the end of my recordset?

Question #3: Assuming that I can generate only one email and send it to all recipients, is there a limit as to how many email addresses (or charachters) I can place in the variable "strTo"?

Thank you,
Michelle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top