Re: Detecting failures in ms-Access

<[email protected]>
Newsgroups gmane.mail.blat
Message-ID <[email protected]>
Hi.

From this function in a separate module (you'll find it in the examples folder as Tim said);
Public Function SendMail(MailTo As String, _
                    Sujet As String, _
                    Detail As String, _
                    From As String, _
                    ServSmtp As String, _
                    Optional altBody As String, _
                    Optional imgBody As String, _
                    Optional AttachFiles As String, _
                    Optional Mailcc As String, _
                    Optional Mailbcc As String, _
                    Optional Priority As MailPriority = &H2, _
                    Optional Confirmation As Boolean) As Boolean
. . . . .

It can then be called from within a form using a button or what so ever can be used to trigger that function then simply waiting for the boolean returned value after a positive or negative answer back from the function.
Here is what I use;

If SendMail(Me.txtClientCourriel, _
                    "État de compte", _
                     strNomBody, _
                     strFrom, _
                     strServSmtp, _
                     strAltBody, _
                     strImgBody, _
                     strNomAttached, _
                     , _
                     strFrom) = True Then
          MsgBox "Le fichier a été généré, envoyé et" & vbCrLf & _
                       "transferé dans le répertoire des documents envoyés!", vbInformation, "PDF Ok"
                        fs.MoveFile strNomAttached, conPath & "_Envoyées\"
 End If

It simply does two things, send the email then pops a message up saying the email was successfully sent if it was (true). Can easily be adapted to display another message in the event that the returned boolean is false.

Good luck
Typhonj
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.