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
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