[AccessD] PDFs

David Emerson newsgrps at dalyn.co.nz
Fri Feb 19 14:37:15 CST 2010


Tony,

Here is a simple solution for emailing that I have used for a couple 
of clients.  All it required is a reference to Microsoft CDO for 
Exchange.  I found my copy in C:\Program Files\Common Files\Microsoft 
Shared\CDO\CDOEX.dll.

Public Function basEmailSalesSupport(strEmailTo As String, strSubject 
As String, strTextBody As String, strAttachment As String)

     On Error GoTo Err_basEmailSalesSupport

     Dim msg As Message
     Dim strSMTPServer As String, intSMTPConnectionTimeout As 
Integer, intSMTPServerPort As Integer
     Dim strOrganisation As String, strFrom As String

     DoCmd.Hourglass True
     strSMTPServer = DLookup("EmailSMTPServer", "dbo.tblVariable")
     intSMTPConnectionTimeout = DLookup("EmailSMTPConnectionTimeout", 
"dbo.tblVariable")
     intSMTPServerPort = DLookup("EmailSMTPServerPort", "dbo.tblVariable")
     strOrganisation = DLookup("EmailOrganisation", "dbo.tblVariable")
     strFrom = DLookup("EmailFrom", "dbo.tblVariable") 'Email address 
for from person

     Set msg = CreateObject("CDO.Message")
     With msg
         With .Configuration.Fields
             .Item(cdoSMTPAuthenticate) = cdoAnonymous
             .Item(cdoSendUsingMethod) = cdoSendUsingPort
             .Item(cdoSMTPServer) = strSMTPServer
             .Item(cdoSMTPConnectionTimeout) = intSMTPConnectionTimeout
             .Item(cdoSMTPServerPort) = intSMTPServerPort
             .Update
         End With
         .Organization = strOrganisation
         .To = strEmailTo
         .Subject = strSubject
         .TextBody = strTextBody
         .From = strFrom
         If strAttachment <> "" Then
             .AddAttachment (strAttachment)
         End If
         .Send
     End With
     Set msg = Nothing

Exit_basEmailSalesSupport:
     DoCmd.Hourglass False
     Exit Function

Err_basEmailSalesSupport:
      Msgbox "Error Message"
     Resume Exit_basEmailSalesSupport

End Function


Regards

David


At 20/02/2010, Tony Septav wrote:
>Hey All
>May be of some help.
>No need for the gurus to read this cause you are probably doing this
>already.
>In my last 4 or 5 applications I have been allowing the client to
>convert an Access report to a PDF file. The users love it. Today I had
>an interesting conversation with a client, I am currently updating their
>application ( been doing this for the last 15 years) and mentioned the
>ability to convert reports, and they said "Let's do it to all the
>reports" (they can already to it for some). That way we can Email the
>accountants, management and  provide statements to our clients, all
>paperless".
>
>For those of you maybe thinking of going this route I highly recommend
>Leban's Report to PDF converter. It is simple and clean . I am sure
>William would support me on this one.
>
>Anyway I am still struggling on which route to go for an internal EMail
>system.
>
>Hope this helps someone.
>--




More information about the AccessD mailing list