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 -
SendObject works once - one email is placed in the outbox - but then does nothing (no error is generated)
It will only work again by closing down the Access application and reopening it.
[I would swear it worked fine earlier in the day generating multiple emails!]
Tried:
[Rebooting the computer - same problem: works once then not again]
[Cutting out the loop which repeats SendObject - works once then on activating the function again does nothing]
! mystified ! ?? any suggestions ??
** Code **
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 nRecepients 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
sendMessage = sendMessage & " this and that and this and that "
editmessage = False
templateFileName = ""
For nRecepients = 1 To 3
'will assign new values to sendTo
DoCmd.SendObject objectType, objectName, outputformat, sendTo, sendCc, sendBcc, sendSubject, sendMessage, editmessage, templateFileName
Next 'nRecepients
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
** END CODE **
I am using DoCmd.SendObject to send emails - just sending a message text but no object.
I run the code -
SendObject works once - one email is placed in the outbox - but then does nothing (no error is generated)
It will only work again by closing down the Access application and reopening it.
[I would swear it worked fine earlier in the day generating multiple emails!]
Tried:
[Rebooting the computer - same problem: works once then not again]
[Cutting out the loop which repeats SendObject - works once then on activating the function again does nothing]
! mystified ! ?? any suggestions ??
** Code **
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 nRecepients 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
sendMessage = sendMessage & " this and that and this and that "
editmessage = False
templateFileName = ""
For nRecepients = 1 To 3
'will assign new values to sendTo
DoCmd.SendObject objectType, objectName, outputformat, sendTo, sendCc, sendBcc, sendSubject, sendMessage, editmessage, templateFileName
Next 'nRecepients
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
** END CODE **