doCmd.sendObject stops

dapiaoen

Registered User.
Local time
Today, 07:25
Joined
Apr 6, 2003
Messages
36
I have a few tables with related data to send to interested contacts (in a table). I've put a button on a form, tied it to a module, and executed it successfully, looping through the records and checking that each contact is found and appropriate data put into the a message. However, when I use the sendObject, it successfully sends mail twice (I am editing before sending), with all data where it belongs. On the third attempt to send mail with the sendObject, it simply skips over that line of code. I have a message being displayed before and after the doCmd line, and they both display for the rest of the table, but no mail is ever sent after the first two email.

Heres the code (from work, so I had to scan it and the sendObject line may not be perfect):

DoCmd.SendObject , "", "", strPOCs, "ncfrost", "", strEmailSub, strEmailMsg & strEmailIssues, All, True, ""

All the code is attached. I'm new to this, so any suggestion for better coding would be much appreciated.

When this is solved, maybe someone can tell me why, when I use a macro to send email using a button on a form/subform displaying exactly the data I want, I can't filter to just the subform data. It always takes the entire table of data and attaches it.

Thanks.
 
SendObject Stops

Jack,

Thanks. That explains it. My email message is quite long so maybe that is it. I'll try to get the patch, but I work in an area where getting patches is not always easy. So, I'll probably have to type in all the code....Ugh.

What about filtering with the macro, SendObject? My form displays the contacts, the subform has the data, but a call to the macro with a button always attaches all the data in the query supporting the form. I've tried setting the filter to child_ID = parent_ID, but still the same. I'll probably do a work around. Pop up a new form that isolates what I need.

Thanks, again.
 
You can copy and paste the code while you are online to the article....

I'm sorry but I don't do macros so I am unsure of what you are trying to do with the 'filter'. If you can give a little more information maybe I can sort it out and do it with code. A bit more detail on what it is your are sending may help too. I admit to not using SendObject very much so no guarantees that I can answer your question.

hth,
Jack
 
dapiaoen:

I use SendObject alot, but never have had a problem with it sending out all of the records. I use a multi-select list box on the form to grab the recipients. Is your send code bound to a button on the form itself?
 
I could copy and paste if I was allowed to bring a floppy disk into a secure area. Can't. We have an isolated network.

Trying to do basically the same thing as with other code (I tried to attach it on first post, but didn't notice if it attached). But, only using a displayed form with subform and button to call the sendObject macro. It allows an Object type/name/output. This is easy. But calling sendObject takes the entire query result that supports the subform and attaches all the records. I try to ApplyFilter prior to the send, but no filter works. I'm using the same query for the Form and subForm, so I'll probably have to split the query. Can only try.

Bottom line, there are only 18 emails to send, so I'll quickly copy and paste to get them out, then figure out what I'm doing.

Thanks,
 
SendObject Stops

Friday,

Guess you're lucky. The article Jack pointed me too makes SendObject seem impossible -- unless you've got the latest sevice pack and updates. Maybe you do?

But, the button calls the subroutine, that then opens a query and loops through it to grab the addressees and the data to put into the To line and Message text for Outlook. After I build the message, I call doCmd.SendObject. It works exactly twice, then the code runs to the end of the query but skips the doCmd line.

Since I have only 18 addressees, I'll do two and at time, marking the ones sent, then close and reopen the database.

Thanks, and if you have other ideas, I'd like to fix it.
 
I had the DoCmd.SendObject do this before with someone I was trying to help but that was some time ago and I do not recall exactly how we got it to work. I think that once we were sure the basic code was right we imported everything into a new database and that cured the problem. I cannot guarantee that that is how we fixed it, but it might be worth a try. I remember that it drove me nuts trying to solve it but once it was working it stayed working.

Good luck!

Jack
 
SendObject stops

Jack:

Came to work this morning, started sending emails (I was going to do 2 and then reset) and saw bad data in the emails. Noticed that memo fields from the table were being truncated to, probably, 255 (I've seen this caused by using the @;"None" to format a memo, but I removed all that), and there were extra control codes in the middle of lines.

I recovered from a fairly new copy of the database, and the function using the SendObject worked like a champ. So, it must have hiccuped on bad data and decided not to tell me. Or, it could be because it is Monday.

Thanks for your help.
 
Hey, good news! Glad that things are working as they should and I suspect that it will continue to work as it is supposed to. And formatting a memo field will truncate it to 255 characters....

Continued success with your project...

Jack
 
Truncated Memo fld

Wouldn't it be nice if Access help would actually tell you that. In fact, it should Alert you if you tried to format it. Or, not allow it. Something useful so some fool like me doesn't apply a format to a lot of good data and zap it.

Thanks,
 

Users who are viewing this thread

Back
Top Bottom