DoCmd.SendObject

J

Jim Bunton

Windows xp, Access 2000 Outlook Express 6

I am using DoCmd.SendObject to send emails - just sending a message text but no object.

I run the code (below)-
SendObject works once - one email is placed in the outbox - but when used again does nothing (no error is generated)
It will only work again by closing down the Access application and reopening it. Then works as before - generates just one email.
Substituting 'real' email addresses for the dummy ones makes no difference
[I would swear it worked fine earlier generating multiple emails!]

[Tried:-
Reinstall Office
posting this to the Access NewsGroup - no response!]
Rebooting the computer - same problem: works once then not again]

! mystified ! ?? any suggestions ??

** Code **
'REM Public Function mySEndEmails_withSEndObject(Recipients As String, Subject As String, emailBody As String)
'REM Test function for debug below
Public Function mySendEmails_withSendObject()
On Error GoTo Err_mySEndEmails_withSEndObject
Dim objectType As Integer
Dim objectName As String
Dim outputformat As String
Dim sendTo As String
Dim sendCc As String
Dim sendBcc As String
Dim sendSubject As String
Dim sendMessage As String
Dim editmessage As Boolean
Dim templateFileName As String
'for debug
Dim RecipiantNo As Integer

objectType = acSendNoObject
objectName = ""
outputformat = ""
sendTo = "(e-mail address removed)"
sendCc = ""
sendBcc = ""
sendSubject = "Test auto emailing"
sendMessage = "test msg content" & vbNewLine & "Next Line" & vbNewLine & " this and that and this and that "
editmessage = False
templateFileName = ""

' REM For nRecipiantNo = 1 To 3
'REM loop will assign new SendTo's
DoCmd.SendObject objectType, objectName, outputformat, "(e-mail address removed)", sendCc, sendBcc, sendSubject, sendMessage, editmessage, templateFileName
DoCmd.SendObject objectType, objectName, outputformat, sendTo, sendCc, sendBcc, sendSubject, sendMessage, editmessage, templateFileName
' REM outNext 'RecipiantNo
MsgBox "Emails sent", vbOKOnly, "End"

Exit_Err_mySEndEmails_withSEndObject:
Exit Function

Err_mySEndEmails_withSEndObject:
Dim errMsg As String
errMsg = Err & " " & Err.Description
MsgBox errMsg, vbOKOnly, "Auto eMail error"
Resume Exit_Err_mySEndEmails_withSEndObject
End Function
 
J

Jim Bunton

The problem with SendObject:
Only sends once In Access 2000

Resolution:- Install Service Pack 3 for Office
Details at
http://support.microsoft.com/kb/260819/en-us

Windows xp, Access 2000 Outlook Express 6

I am using DoCmd.SendObject to send emails - just sending a message text but no object.

I run the code (below)-
SendObject works once - one email is placed in the outbox - but when used again does nothing (no error is generated)
It will only work again by closing down the Access application and reopening it. Then works as before - generates just one email.
Substituting 'real' email addresses for the dummy ones makes no difference
[I would swear it worked fine earlier generating multiple emails!]

[Tried:-
Reinstall Office
posting this to the Access NewsGroup - no response!]
Rebooting the computer - same problem: works once then not again]

! mystified ! ?? any suggestions ??

** Code **
'REM Public Function mySEndEmails_withSEndObject(Recipients As String, Subject As String, emailBody As String)
'REM Test function for debug below
Public Function mySendEmails_withSendObject()
On Error GoTo Err_mySEndEmails_withSEndObject
Dim objectType As Integer
Dim objectName As String
Dim outputformat As String
Dim sendTo As String
Dim sendCc As String
Dim sendBcc As String
Dim sendSubject As String
Dim sendMessage As String
Dim editmessage As Boolean
Dim templateFileName As String
'for debug
Dim RecipiantNo As Integer

objectType = acSendNoObject
objectName = ""
outputformat = ""
sendTo = "(e-mail address removed)"
sendCc = ""
sendBcc = ""
sendSubject = "Test auto emailing"
sendMessage = "test msg content" & vbNewLine & "Next Line" & vbNewLine & " this and that and this and that "
editmessage = False
templateFileName = ""

' REM For nRecipiantNo = 1 To 3
'REM loop will assign new SendTo's
DoCmd.SendObject objectType, objectName, outputformat, "(e-mail address removed)", sendCc, sendBcc, sendSubject, sendMessage, editmessage, templateFileName
DoCmd.SendObject objectType, objectName, outputformat, sendTo, sendCc, sendBcc, sendSubject, sendMessage, editmessage, templateFileName
' REM outNext 'RecipiantNo
MsgBox "Emails sent", vbOKOnly, "End"

Exit_Err_mySEndEmails_withSEndObject:
Exit Function

Err_mySEndEmails_withSEndObject:
Dim errMsg As String
errMsg = Err & " " & Err.Description
MsgBox errMsg, vbOKOnly, "Auto eMail error"
Resume Exit_Err_mySEndEmails_withSEndObject
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SendObject 1
DoCmd.SendObject and Signatures 0
Send email from access form 3
Email issue 0
email as a pdf 1
Email 180 column table/view dilemna 0
email forms and reports 1
SendObject Action Message 1

Top