Attach multiple reports to GroupWise e-mail

I need to attach multiple reports (.rtf documents) to an e-mail that is being sent to multiple recipients.

Does anyone know how to automate this with Access 2000 and GroupWise Version 5.5 e-mail?

Thanks,
BJS


Post your answer or comment

comments powered by Disqus
I have a form set up with multiple option buttons for the user to select a report to e-mail. The final option button is for the user to select "all" reports to e-mail. I am using Select Case and then on the "all reports" case, it has a DoCmd to open each report one at a time and send each via email as a snapshot. (I can't find a way to send multiple reports on one e-mail). The problem is, the user wants to attach a new subject line each week when the report is sent. I don't want it to stop on each report (the reports take a long time to run). I was thinking I could add a field to the form for the user to type in the new subject line for that week and have the code referenct that field, but I don't have a clue as to how to begin. Anyone with any ideas?? Thanks!!

okay...hopefully a really simple question....does anyone know how to attach a report as an e-mail attachment????

Thanks in advance!!!

S

There are a load of threads on e-mailing reports, but I couldn't find one that answered this question. Is there a SendObject command that will attach multiple reports in one e-mail. For example I have the following code in a form:

DoCmd.SendObject acReport, "REPORT1", "SnapshotFormat(*.snp)", "", "", "", Forms![PAGE1AQS]![NamedInsured]

However, I want to also send "REPORT2" or "REPORT3" in the same e-mail. Can this be accomplished? Thanks in advance for your invaluable insights.

Matthew

Does anyone know how to attach a word document to a e-mail from a database through code. I have a list of clients in a database with their e-mail addresses and I need to send an e-mail to them with a attachment. There are about 1000 clients that need this e-mail.


Any help would be appreciated!

Hello everyone,

I would really really appreciate if someone can assist me with the VBA coding for this process... or let me know if this is even possible.
I am using Access 2002-2003 as a Microsoft Access Project using SQL Management Studio as a backend server.

I need help creating a VBA code for a button on a form that would sebd multiple reports as individual e-mail attachments. Each e-mail would be sent to an address which is referenced as one of the form's field controls.
The form would first be filtered so the report is filtered accordingly.
The report itself is a certificate which is used to confirm a person's completion of an educational course. Fields for Name, Organization, Course, and Semester are used. Semesters are by year as Spring, Summer, or Fall.

So far, I have only used code to filter the report based on the form:

Private Sub Report_Open(Cancel As Integer)
Me.Filter = "Semester='" & Forms![Agency_University_Certificates_for_Email]![Semester] & "'"
Me.FilterOn = True
End Sub

Is it possible to click a button on the form which can send the filtered report to multiple e-mail addresses? I want the reports to be separated and sent according to each e-mail address (basically a mail merge).

Thank you for your assistance and guidance and for reading this post. I am open to any suggestions!

When using MSAccess 2002 the VB line :
'DoCmd.SendObject acTable, "tblSend", "MicrosoftExcelBiff8(*.xls)", "E-Mail Address", "", "", "A60", "Orders", False, ""
Would send to the E-mail Address that was listed in E-Mail Address but converting to MSAccess 2003 and using the same Email GroupWise 7.03 It leaves the To blank any ideas?

Hi,

This is forum has been very helpful to me on my latest database project. I'm now stuck and hoping you all can help me out. This is an urgent request so hopefully someone here has dealt with the same problem.

First off, I hope I'm posting in the right forum.

I'm printing a report to .pdf. I'm using pdf995 and pdf995edit. Upon creating the file, I have code that automatically attaches the file to an e-mail. Everything works great, but I'm finding that after the code executes, the pdf995 printer remains the default. Ideally, I would like the code to execute, print to the pdf995 printer and reset the default printer to the applicable network printer. This is also running across a network. The pdfwriter is on the client, while the database is on a server. Here's the code I'm using now.


	Code:
	Private Sub btnEmail_Click()

' If you don't want the report dialog box being displayed
' asking what name you want to give the pdf report, you will
' need pdfEdit995.  With pdfEdit995t you tell pdf995 what directory
' and what file name to initially give the pdf report.
'
' Quote from PDF; "pdfEdit995 has autoname features. I recommend setting
' the PDF to be named based on the document being printed. Create a
' temporary report with the name of the PDF you want and tell it to
' print to PDF995. The Save As dialog won't appear."

    Dim strDir As String
    Dim strFile As String
    Dim fOK As Boolean

    ' Directory to place the PDF files that are to
    ' be printed
    strDir = "D:Documents and SettingsHeatherMy DocumentsOutsourced ProjectsTyco"
    ' Name of file to create
    strFile = "DFM Summary Statistics Queried " & Format(Date, "Long Date") & ".pdf"
  
    ' Create the report
    DoCmd.OpenReport "rptStats", acViewNormal
    
    ' Copy the created file (name is Output.pdf) to the
    ' directory and file name specified above
    fOK = CopyFile_TSB(strDir & "Output.pdf", strDir & strFile)
     'If the file didn't copy properly, tell the user
    If Not fOK Then
       Beep
       MsgBox "File Copy Failure"
   End If
SendMessage (strDir & strFile)
End Sub

Function CopyFile_TSB(strSource As String, strDestination As String) As Boolean
' Comments  : copies a file
' Parameters: strSource - source file
'             strDestination - destination file
' Returns   : True if successful, False otherwise
'
    Const BufferSize = 9000


    Dim strBuffer As String * BufferSize
    Dim strTempBuffer As String
    Dim intSourceFile As Integer
    Dim intDestinationFile As Integer
    Dim lngCounter As Long

    On Error GoTo PROC_ERR

    intSourceFile = FreeFile
    Open strSource For Binary As #intSourceFile

    intDestinationFile = FreeFile
    Open strDestination For Binary As #intDestinationFile

    For lngCounter = 1 To LOF(intSourceFile)  BufferSize
        Get #intSourceFile, , strBuffer
        Put #intDestinationFile, , strBuffer
    Next lngCounter

   lngCounter = LOF(intSourceFile) Mod BufferSize

    If lngCounter > 0 Then
        Get #intSourceFile, , strBuffer
        strTempBuffer = Left$(strBuffer, lngCounter)
        Put #intDestinationFile, , strTempBuffer
    End If

    Close #intSourceFile
    Close #intDestinationFile
    CopyFile_TSB = True

PROC_EXIT:
    Exit Function

PROC_ERR:
    CopyFile_TSB = False
    Resume PROC_EXIT

End Function

Private Sub btnCancel_Click()
On Error GoTo Err_btnCancel_Click

    Dim stDocName As String

    stDocName = "CustStatsSelect.Cancel"
    DoCmd.RunMacro stDocName

Exit_btnCancel_Click:
    Exit Sub

Err_btnCancel_Click:
    MsgBox Err.Description
    Resume Exit_btnCancel_Click
    
End Sub

Sub SendMessage(Optional AttachmentPath)

           Dim objOutlook As Outlook.Application

               Dim objOutlookMsg As Outlook.MailItem

               Dim objOutlookRecip As Outlook.Recipient

               Dim objOutlookAttach As Outlook.Attachment



               ' Create the Outlook session.

               Set objOutlook = CreateObject("Outlook.Application")



           ' Create the message.

           Set objOutlookMsg = objOutlook.CreateItem(olMailItem)



           With objOutlookMsg

              ' Add the To recipient(s) to the message.

             Set objOutlookRecip = .Recipients.Add("heather@digitalcampground.com")

              objOutlookRecip.Type = olTo


              ' Add the CC recipient(s) to the message.

              Set objOutlookRecip = .Recipients.Add(" ")

              objOutlookRecip.Type = olCC



              ' Set the Subject, Body, and Importance of the message.

              .Subject = "DFM Statistics Summary"

              .Body = ""

              .Importance = olImportanceHigh  'High importance



              ' Add attachments to the message.
                Dim strFile As String
                strFile = "D:Documents and SettingsHeatherMy DocumentsOutsourced ProjectsTycoDFM Summary Statistics Queried "
& Format(Date, "Long Date") & ".pdf"


              If Not IsMissing(AttachmentPath) Then

                 Set objOutlookAttach = .Attachments.Add(strFile)

              End If



              ' Resolve each Recipient's name.

              For Each objOutlookRecip In .Recipients

                 objOutlookRecip.Resolve

                 If Not objOutlookRecip.Resolve Then

                 objOutlookMsg.Display

              End If

              Next

              .Display



           End With

           Set objOutlookMsg = Nothing

           Set objOutlook = Nothing

        End Sub

I appreciate any help you can give me!

Thanks in Advance

Heather

how do you attach multiple reports in an email through code to put behind a button?

Two questions...

1) I have a form where orders are inputted. I want a button to be able to be clicked with will open a form based on the value of the autonumber (order number) how do I do this?

2) How can I get a report to be e-mailed to the address that is shown on the report (I enter the data when the order is processed) without having to manually enter the e-mail address into outlook when i press the mail report button

Does this make sense?

I create a little template in word, which has pop up forms and then the last form you have the choice to send the document automatically to a specific recipient by outlook, but the problem is that when the program opens outlook, by default everyone has the "Use Microsoft Word to edit e-mail messages" check.

I was able to find this on the microsoft website...
**********************************************
http://support.microsoft.com/default...;en-us;q237338

When you are using Microsoft Word to edit e-mail messages (in Microsoft Outlook 2000, on the Tools menu, click Options and then click the Mail Format tab) and you try to automate Word from another program, you may encounter problems processing some Word commands. For example, you may receive Automation errors such as "This method or property is not available" or other errors.

This article describes how to check whether WordMail is running when using Automation to automate Word from another program.
*************************************************

This is the code I have in my function to send the document in Outllook.


Public Function SendMessage(DisplayMsg As Boolean, Optional AttachmentPath)

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.mailitem
Dim objOutlookRecip As Outlook.recipient
Dim objOutlookAttach As Outlook.attachment

'Create the outlook session.
Set objOutlook = CreateObject("Outlook.Application")
'Create the message
Set objOutlookMsg = objOutlook.createItem(olMailItem)
With objOutlookMsg
'Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("mtlserrurerie")
objOutlookRecip.Type = olTO
'Set the subject, Body,and Importance of the message
.Subject = "Demande de clé"
.body = ""
.importance = olimportancehigh 'High Importance
'Add attachment to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
'Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
'Should we displaythe message before sending?
If DisplayMsg Then
.Display
Else
.Save
.send
End If
End With
Set objOutlook = Nothing

End Function
************************


I was wondering if I can code the form to remove the check mark from the Option in Outllook.

I am using OfficeXP

hi frnds

i have an access application in which some reports are generated.
i want to add e-mail feature in this application, so that the reports can
be send via e-mail.


please also tell me how to disable keyboard shortcuts for numerous option like open,close,save,new etc ( through vb code )

regards
akhil

I am trying to send e-mails to customers in a batch with my Access database. I have created a recordset with the desired document id's and I have put a sendobject statement in a loop of this recordset.


	Code:
	DoCmd.SendObject acSendReport, "rptInvoice", acFormatPDF, email, , , subject, msgText, False

The problem is, the report, wich is the invoice, needs to be filtered separately for each e-mail / pass of the loop. The only way I can think of to do this in code is to open the report, apply a filter, and save the report. Not sure if this will work or not but if it does it will cause the report to flash on the screen each pass of the loop. Can anyone direct me as to how to e-mail invoice reports in a batch, each one filtered for it's intended recipient?

I am using a form for users to enter requests. Currently when a user enters a request an email is generated using the sendobject command and i send the whole table in .xls format as an attachment to my e-mail. I'd rather when a request is entered that an email is sent to me with only the newest request in the body of the email. How can I go about doing this? As always thans a bunch in advance.

I have a textbox which I allow the User to enter text. Kinda of like an area where it keeps a log activity.

By pressing CTL + ENTER, it will give a LINE BREAK in the text box, which is great.

But if I want to pass the multiline text to an e-mail and/or insert it into a database, how do I preserve the LINE BREAKS from the text box?

Thoughts?

Is there a to convert multiple reports to one PDF with VBA? I have a large amount of pdfs to produce around 4000. One of my other large problems I can not download any tools to help with this. I am using access 2010 and I have Adobe PDF Writer installed.

My db uses a command buttom to send e-mail by Outlook.
The following code selects the record to preview then e-mail.
I'd like to be able to select multiple records as attachments on the one e-mail.
I suppose I'd need additional field(s) on the form to select the records but I'm not sure how to write this.
Code or threads appreciated.

DoCmd.OpenReport "email report", acViewPreview, , "[ID]=" & Forms![data]![ID]
DoCmd.SendObject acReport, stDocName, acFormatRTF, , "to.you@company.co.uk","copytome@business.co.u k , "E-mail subject", "There are some attachments (hopefully) with this e-mail", True

Thanks

Hello:
Hopefully I've posted this in the right forum.

I would like to automate the current process of sending an e-mail with a PDF attachment that is unique to each recipient; it is their test results. I’m sending an e-mail one at a time (which was fine when the number of folks being tested was small, but now I’m up to approximately 200 e-mails and growing each year) which I’m sure you can appreciate is very time consuming.

Please Note: I’m not a programmer type and I’m ignorant with respect to macro code creation. I'm hoping this type of issue as been faced before (did not find any related posts though) and that a solution is available.

System Environment:
Windows 7 SP1 (64 bit)
Office 2010 Professional

Access environment and Process:
1. A qry object/letter is built based on 4 tables (test results, result averages, a global employee list and location)

2. The Report has both static and dynamic text. Examples include: “Dear” [qry-Letter. F_name] and Address Information
a. =[qry-Letters.F_Name] & " " & [qry-Letters.L_Name]
b. =[qry-Letters.Position]
c. ="Dept " & Right([qry-Letters.Dept],3) & ", " & [qry-Letters.City]

3. The report also includes the employee’s results, the session averages (testing is conducted at multiple locations each occurrence is a session) and companywide averages.

4. Report Process: Run the report, entering primary key Emp_ID, report is populated saved (overwritten with the next Emp_ID and printed as a saved PDF.

5. MS Outlook: create a new e-mail, text body is common to all e-mails e.g. ‘attached are your test results’ the PDF is attached and the e-mail sent to the recipient (the e-mail address follows the corporate standard, =Trim([qry-Letters.F_Name] & "." & [qry-Letters.L_Name] & "@abc.com")

Hopefully I provided sufficient background information. But if not ask away.

Any assistance in automating the aforementioned process(es) would be greatly appreciated.

Cheers,

Hecanuck (FYI … Male Canadian … smile)

I have made a little database that is used to enter details shipments and where users can print labels for the different shipments showing country, zip code and city of destination. All information is stored in a table for analysis via several reports.

We have two forwarders that we use for our shipments and they should get twice a day a list of destinations for each country; a preliminary and a final list.

For example on a certain day I have:
3 shipments going to France
4 shipments going to Germany
7 shipments going to the UK

What I want is that
Forwarder A gets 1 report e-mailed for France shipments
Forwarder B gets 1 report e-mailed for Germany shipments
Forwarder B gets 1 report e-mailed for UK shipments

so 1 e-mail per country for forwarder A or B

Any ideas how to best solve this complex matter??

I am currently working on a database that will be sending out multiple reports but they need to be sent from different e-mail profiles. I have the two profiles set up but I am at a loss with how to select which profile to use in my code.

Here is a sample:


	Code:
	Dim obEmail As Object, obMsg As Object, obAttachment As Object, stDelim As String, exAttach As String

stDelim = ";"
Set obEmail = CreateObject("Outlook.Application")
Set obMsg = obEmail.CreateItem(olMailItem)

With obMsg
    .subject = "Ordering Report"
    .To = "users"
    .Body = "Please see attached."
    .Send
    
End With

Set obEmail = Nothing
Set obMsg = Nothing

End Function

I thought about using the 'SentOnBehalfOfName' property but from what I've seen this does not change the e-mail address. This is key since the recipients will probably reply back and these replies need to be routed to the correct profile.

Hi all,

I have recently taken over a project at work to develop a database from a colleague and have hit a stumbling block on the following module that was originally written to send an Access report as an e-mail attachment.

I have used it to add in a routine which saves a copy of the report on our network, and this part appears to be working reliably, however only some of our machines are successfully executing the code to send the report via e-mail using the SendObject command. All machines are running Office 2003 SP3 on Windows XP SP3.

The following is the module extracted to a text file:


	Code:
	Attribute VB_Name = "mdlSendEmail"
Option Compare Database

'sends rejection report e-mails and saves copy to shared area

Public Function Sendrpt3()
Dim variableCC As String
Dim Scheme As String
Dim Street As String
Dim Packref As String
Dim datestamp As String
Dim Filename As String

On Error Resume Next

Scheme = Forms!frmpackdata.txtAsset
Street = Forms!frmpackdata.TxtStreet
Packref = Forms!frmpackdata.txtPack
datestamp = Format(Now, "yyyyMMdd-hhmmss")
Filename = "network pathreports" & datestamp & "-" & Packref & ".snp"

    DoCmd.OutputTo acReport, "rptESRIReport", "SnapshotFormat(*.snp)", Filename, False, "", 0


    If Forms!frmpackdata!txtCoord = "" Then
        variableCC = ""
    Else
        variableCC = Forms!frmpackdata!txtCoord & "@companyname.com"
    End If
    
    ' handle scenario where the above lines still only returns the e-mail domain name @companyname.com
    If variableCC = "@companyname.com" Then
        variableCC = ""
    End If
    
    DoCmd.SendObject acReport, "rptESRIReport", "SnapshotFormat(*.snp)", Forms!frmpackdata!txtOneNet & "@companyname.com",
Forms!frmpackdata!txtTeamLeader & "@companyname.com" & "; " & variableCC, "di.audit@companyname.com", "QA Audit Rejection -
Pack Ref " & Packref & ": " & Scheme & " - " & Street, "", True, ""
 
End Function

I'm at a bit of a loss as to how this seems to be executing fine on some machines and not others, are there any known issues with the SendObject command in Office 2003 which would explain this behaviour and is there a better, more reliable method of achieving it?

Hi,

I can get Access to automatically send a report in an e-mail using the following code. However, is it possible to add into the code a line to pick up an attachment as well as the report from a file path?

Dim strText As String
Dim SubjectLine As String
Dim EmailAddress As String
Dim Msg, Style, Title, Response
Dim Capita As String
Dim stDocName As String
stDocName = "rptAcademyReport"


Msg = "Do you want to send call report to Academy?"
Style = vbYesNo + vbDefaultButton2
Title = "Email Confirmation"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then

EmailAddress = "lee@derby.co.uk"
Capita = [Forms]![frmHD]![CapitaID]

SubjectLine = "Derby Homes Help Desk Call "
DoCmd.SendObject acReport, stDocName, "RichTextFormat(*.rtf)", EmailAddress, , , SubjectLine, _
"Please log this call and return details to sender." & vbCrLf & vbCrLf & "Internal Reference: " & Capita, True

Exit_cmdEmailrptAcademyReport_Click:
Exit Sub

Err_cmdEmailrptAcademyReport_Click:
If Err.Number = 94 Then
MsgBox "Data is incorrect or missing"
End If
End If

End Sub

Thanks in advance

Lee

Hello, I have some code put together with help through this site which allows me to send e-mail's out as high importance, voting options, flags..etc.

My issue is I would like to send a report that is built in the current database instead of attaching a report from a network share ?

The process currently loops through 100's of e-mail addresses & e-mail's out the info, but I would like to attach the Access report into this e-mail without having to save it to a network share over a 100 times (this report is built with a dynamic query that will update the info on the report based on the loop)

Any thoughts would be appreciated.

Thank you

In short, how can I do this? Basically I'm wanting to send a Report if the user selects HTML, RTF, or SNP, but a Table if they select XLS or TXT.

I'm also trying to control the name of the file being attached to the e-mail.

Anyone know how to do either of these?

Team,

How do I get multiple reports to export & save as a pdf then attach to a single email?

I'm using the code below, but I have no idea how to tailor it to handle more than 1 report.


	Code:
	Private Sub Email_Decorations_Click()
Dim strRep As String
Dim strDPath As String
Dim strFName As String
' What report to send
strRep = "Decorations Pending"
' Initial Path
strDPath = "Path name here"
' Filename
strFName = "Decorations.pdf"
' Output report as pdf
DoCmd.OutputTo acOutputReport, strRep, "PDFFormat(*.pdf)", strDPath & strFName, False, "", 0
' Send the report to whoever
Send_Dec (strDPath & strFName)
End Sub
Private Sub Send_Dec(strDoc As String)
Dim sTo As String
Dim sCC As String
Dim sBCC As String
Dim sSub As String
Dim sBody As String
Dim strCC As String
Dim OutApp As Object
Dim OutMail As Object
Dim varPress As Variant
    ' Get the email address from the current form control
    sTo = ""
 
    '  Set the subject
    sSub = "Evals & Decs"
    ' Build the body of the email
    sBody = "Team," & vbCrLf & vbCrLf
    sBody = sBody & "Here is the current decorations list for action."
 
    ' Create the email
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    sCC = ""
    sBCC = ""
 
 
    With OutMail
        .To = sTo
        .CC = sCC
        .BCC = sBCC
        .Subject = sSub
        .Body = sBody
        .attachments.Add (strDoc)
        .display
 
    End With
    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub




Not finding an answer? Try a Google search.