[AccessD] A2003:Sending Mail in Outlook Failing Using Redemption

Darren DICK d.dick at uws.edu.au
Wed Mar 16 17:38:03 CST 2005


Cross Posted to Sue and Dmitry's list

Hello all
I am putting together some email code that gets all the records from a temp table, loops through all the email address in that temp
table and sends an email to those persons using Outlook (11) and Using redemtion

If I have say.5 Email address in the temp table and I run the code , The first 2 records from the temp table have emails created for
them and the emails can be 'seen' in the 'Drafts' folder of Outlook (As Expected) but the code then fails on the 3rd (Regardless of
the email address) with the following error

Run-time Error '-2147418113(8000fff)
Method Update Not Supported By Automation Object CONTINUE END DEBUG HELP

When I click on Debug
It highlighs the  .Send line in the code below I didn't think I was updating anything ith the code below

Any suggestions welcome

Many thanks

Darren

<Code>
    Dim db As DAO.Database
    Dim sel_SQL As String
    Dim rs As DAO.Recordset
    Dim intRecordCount As Integer
    
    Dim strFirstName As String
    
    Dim gappOutlook As New Outlook.Application
    Dim msg
    Dim omsg
    
    sel_SQL = "SELECT * FROM [tmptblEmailAddresses]"
    
    Set db = CurrentDb()
    Set rs = db.OpenRecordset(sel_SQL)
    
    Set omsg = gappOutlook.CreateItem(olMailItem)
    Set msg = New Redemption.SafeMailItem

    msg.Item = omsg

    With rs
        If (rs.EOF) Then
            MsgBox "There are no Persons who have registered an interest in this Activity/Event", vbInformation, "No Registrations"
        Else
            With msg
                While (Not (rs.EOF))
                    strFirstName = rs!FirstName
                    .To = rs!EmailAddress
                    .cc = Me.txtCC
                    .bcc = Me.txtBCC
                    .Subject = Me.txtSubject
                    .Attachments.Add Me.txtAttachment
                    .Body = "Hi " & strFirstName & vbCrLf & vbCrLf & Me.txtBody
                    '.Display
                    .Send '<========DEBUG COMES HERE WHEN IT ERRORS
                    rs.MoveNext
                Wend
            End With
        End If
    End With

</Code>




More information about the AccessD mailing list