SendMethodObject

V

VAL

Why and how can Bcc work???? Please. Please send me the event, rewritten -
not explanation - I am new at this and this to me is complicated.

THANK YOU.

Private Sub BroadcastAll_Click()
Dim stDocName As String
Dim stLinkCriteria As String
Dim stSubject As String
Dim stBcc As String

stLinkCriteria = Me![EmailAddressUser]
stSubject = "Educarium Information"
stBcc = Me![EmailAddressAdmin]

DoCmd.SendObject acSendNoObject, , , stLinkCriteria, , , stSubject, , ,
stBcc

End Sub

It works except for : Nothing is in Bcc and if user changes it's mind and
doesn't send the email, the error/debug message pops up.
 
E

Eric Blitzer

Try using error trapping info.
My code looks something like this

On Error GoTo test_email_snapshot_Err

DoCmd.SendObject acReport, "Report name", "SnapshotFormat(*.snp)",
"toperson", "ccperson", "bccperson", "this is the subject", "This is the
message text", True, ""


test_email_snapshot_Exit:
Exit Function

test_email_snapshot_Err:
MsgBox Error$
Resume test_email_snapshot_Exit
 
B

BruceM

It just needs a little rearranging and fewer commas:
DoCmd.SendObject acSendNoObject, , , stLinkCriteria, , stBcc, stSubject

Check Help for Send Object. Really. It is spelled out in there.

I omitted DocName from the code, since you don't use it (no reason you would
with acSendNoObject).
To trap the error message:

Private Sub BroadcastAll_Click()

On Error GoTo ProcErr

Dim stLinkCriteria As String
Dim stSubject As String
Dim stBcc As String

stLinkCriteria = Me![EmailAddressUser]
stSubject = "Educarium Information"
stBcc = Me![EmailAddressAdmin]

DoCmd.SendObject acSendNoObject, , , stLinkCriteria, , stBcc, stSubject

ProcExit:
Exit Sub

ProcErr:
If Err.Number = 2501 Then
GoTo ProcExit
End If
msgbox "Error #" & Err.Number & ", " & Err.Description & " -
BroadcastAll_Click"
Resume ProcExit

End Sub

The parts I have added (On Error, ProcExit:, and ProcErr:) are an efffective
way of identifying error messages. Note that ProcExit: and ProcErr: need
colons as written, and need to be all the way to the left in the code
window.
If you omit:

If Err.Number = 2501 Then
GoTo ProcExit
End If

you can learn the error number when you cancel the e-mail. I think the
error # is 2501, but you should check it yourself. Once you know the error
number, add the code I told you to omit, using the error number you noted
from the error message.
 
Top