Home All Groups Group Topic Archive Search About
Author
28 Feb 2007 12:21 PM
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 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 in the day generating multiple emails!]
[Tried:
Reinstall Office
posting this to the Access NewsGroup - no response!]

Tried:
[Rebooting the computer - same problem: works once then not again]

! mystified ! ?? any suggestions ??

** Code **
'Public Function mySEndEmails_withSEndObject(Recipients As String, Subject As String, emailBody As String)
'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 RecepiantNo As Integer

    objectType = acSendNoObject
    objectName = ""
    outputformat = ""
    sendTo = "DummyO***@Blueyonder.co.uk"
    sendCc = ""
    sendBcc = ""
    sendSubject = "Test auto emailing"
    sendMessage = "test msg content" & vbNewLine & "Next Line" & vbNewLine & " this and that and  this and that "
    editmessage = False
    templateFileName = ""

                      ' remmed outFor nRecepiantNo = 1 To 3
                       'will assign new values to sendTo
        DoCmd.SendObject objectType, objectName, outputformat, "DummyAddre***@Blueyonder.co.uk", sendCc, sendBcc, sendSubject, sendMessage, editmessage, templateFileName
        DoCmd.SendObject objectType, objectName, outputformat, sendTo, sendCc, sendBcc, sendSubject, sendMessage, editmessage, templateFileName
                        ' remmed outNext 'RecepiantNo
    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
--
Jim Bunton

Author
28 Feb 2007 1:43 PM
Bob Butler
"Jim Bunton" <jBun***@BlueYonder.co.uk> wrote in message
news:lteFh.985$1E3.871@fe3.news.blueyonder.co.uk
> Windows xp, Access 2000 Outlook Express 6

You may have better luck asking in an Access VBA newsgroup; DoCmd is
access-specific and has nothing to do with  the VB language that this group
supports.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
28 Feb 2007 2:32 PM
Jim Bunton
Bob - thanks for your response - I'll give that a go

Jim

Show quoteHide quote
"Bob Butler" <tiredofit@nospam.ever> wrote in message
news:%23Yvfw5zWHHA.1212@TK2MSFTNGP03.phx.gbl...
> "Jim Bunton" <jBun***@BlueYonder.co.uk> wrote in message
> news:lteFh.985$1E3.871@fe3.news.blueyonder.co.uk
>> Windows xp, Access 2000 Outlook Express 6
>
> You may have better luck asking in an Access VBA newsgroup; DoCmd is
> access-specific and has nothing to do with  the VB language that this
> group
> supports.
>
> --
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>
Author
28 Feb 2007 2:30 PM
Paul Clement
On Wed, 28 Feb 2007 12:21:37 GMT, "Jim Bunton" <jBun***@BlueYonder.co.uk> wrote:

¤ 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 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 in the day generating multiple emails!]
¤ [Tried:
¤ Reinstall Office
¤ posting this to the Access NewsGroup - no response!]
¤
¤ Tried:
¤ [Rebooting the computer - same problem: works once then not again]
¤
¤ ! mystified ! ?? any suggestions ??

See if the following helps:

SendObject method fails in Access 2000
http://support.microsoft.com/kb/260819


Paul
~~~~
Microsoft MVP (Visual Basic)