Need help

Nancythomas

Registered User.
Local time
Today, 15:08
Joined
Apr 20, 2010
Messages
59
I am looking for help.
I want to email a report as well as the all attachments that is attached in the database to be sent via an email. I have created a cmd button but I do not know how to script this/
The report is a PDF format. and the Attachment is the Attachment Data field type.
 
Nancy, have you tried any code behind that button? Here is the easiest sample I can give you. Understand you have to make a report in Access first, then it can be "exported" into an Adobe PDF format. So behind that button, enter something like this

Code:
    Dim Destination As String
    Dim FileName As String
    Dim Path As String
    Dim TheAttach as String
    Dim ReportName as String
  
' ... code here to make your report
  
    ReportName = "JuneBudget"
    TheAttach = Trim(Me.Attachment.value)  'Grabs what is in the field
    Path = "C:\Documents\Reports\"
    FileName = ReportName  'or you can create you own file name
  
    Destination = Trim(Path & FileName & ".pdf")
  
    DoCmd.OpenReport Report, acViewReport, , , acHidden
    DoCmd.OutputTo acOutputReport, Report, acFormatPDF, Destination, False, , , acExportQualityPrint
    DoCmd.Close acReport, Report, acSaveNo
  
 '... code here to create email with report and attachment
Create the report and the pdf and write back for help on the email creation. And I will tell you there is a lot of good code out there, don't be afraid to google things like ms access make report, or make pdf, or make email. Good luck.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom