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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with 9th argument of the SendObject method

Status
Not open for further replies.

VickyC

Technical User
Sep 25, 2010
206
CA
hello to all

I have a question about the SendObject method when sending either 'CC' or 'BCC', but with no 'To' argument specified. (See below)

Code:
 DoCmd.SendObject _
      , , , , rsMailList!EmailAddress, , Subject, _
      IIf(BodyFlag = True, Body, ""), False

It seems that the EditMessage argument (in this case False) always behaves as True. On the other hand, when just a 'To' argument is specified, the EditMessage arguments acts as expected, allowing the message to be displayed or sent directly. What's up? Am I missing something?

Vicky
 
I do not understand this.
IIf(BodyFlag = True, Body, "")
The edit toggle is a boolean True/False or -1/0.
Is Body some boolean field?
"" does not equal 0 or false, and not sure why this does not give a datatype mismatch.
 
hello MajP - thank you for responding

The 8th argument...
IIf(BodyFlag = True, Body, "")
works as expected. That's not the problem.

The problem is with the 9th argument which, in this case, is False. (see below)

Code:
DoCmd.SendObject _ 
     , , , , rsMailList!EmailAddress, , Subject, _ 
     IIf(BodyFlag = True, Body, ""), False

My problem is that this flag always behaves as True when there is no 'TO' specified (4th argument), but there is a 'CC' specified (5th argument) as in the code snippet.

any ideas for this unexpected behavior?
 
Sorry, I miscounted. My guess is that it is expected behavior. The "to" is a strange 'optional' parameter. If it is blank you still get prompted for a value. Microsoft may figure why have a "CC" without any "To" and thus open it for editing.

TO - This string expression list those recipients’ email addresses who are to appear on the To line of the mail. A semicolon separates the addresses (;). If the mail application does not recognize these email addresses, the application throws an error and the mail is not sent. If this argument is left blank Microsoft Access prompts you for it.

 
thanks MajP - I take your point, but the same behavior happens when BCC is used, and there is good reason, I suspect, to send using 'BCC' without a 'TO'. I've often sent messages to a group of fellow employees this way directly from Outlook Express. But, when I use VBA to send to addresses found in an Access table, I run into the problem where the 9th argument always acting as if it were True.

Just wonderin'
Vicky
 
IMHO, you can't send automatically (SendObject method) a mail to nobody (empty TO:) ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
When we send out CC or BCC emails, for the "TO" part, we send to ourselves or to a common our internal group departmental email that only one or two of us use.
 
I take your point..
That is not my opinion, that is unfortunately the way MS designed it. If you leave the To blank you get prompted for it as stated in the help file. So it is going to put it in "edit" mode.
Access help file and object browser said:
If this argument is left blank Microsoft Access prompts you for it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top