Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send form as pdf or snapshot

Status
Not open for further replies.

tbac

Technical User
Jun 16, 2003
59
US
Currently, if we want to send the output of a filered form to someone, we Print to CutePDF to create a pdf of the form, then save the pdf to a folder, then open Outlook and attach the pdf. My users want to be able to filter a form to the information they want, then click a button to open Outlook with the pdf (or snapshot) already there as an attachment. I would prefer to send a snapshot of the form but if I have to send as a Report (in snapshot format), how can I do that with a button?
 
Reports are printed as snapshot not forms
Here is something what you require.
Code:
Public Sub SendSnapshotReport()
    On Error GoTo ErrorHandler
    'You need to have a folder called "Temp"
    'in the "C:\" drive.
    
    DoCmd.OutputTo ObjectType:=acOutputReport, _
                   objectname:="Catalog", _
                   OutputFormat:=acFormatSNP, _
                   OutputFile:="C:\Temp\Catalog.snp", Autostart:=False
    'Set reference to OUTLOOK Lbrary
    'Microsoft Outlook xx.x library
    
    Dim appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)

    With MailOutLook
        .To = "mymail@gmail.com"
        .Subject = "Subject here"
        .HTMLBody = "Message here"
        .Attachments.Add "C:\Temp\Catalog.snp", olByValue, 1, "XXX_SNP"
        .Send
    End With
ErrorHandlerExit:
    Exit Sub
ErrorHandler:
    If Err = 287 Then    ' user cancelled sending mail
        Resume Next
    Else
        MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
        Resume ErrorHandlerExit
    End If
Exit Sub
End Sub

Code:
Private Sub cmdSendSnapshot_Click()
    Call SendSnapshotReport
End Sub

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top