Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    Join Date
    May 2006
    Posts
    386

    Red face Unanswered: Please help. Is it possible to send information from a form as an email attachment

    Dear All,
    Over the past one month I have been trying to do this myself but with no avail. I am not very good with codes, so I tried using Access's built in functions but with no luck.

    We have a Form (MainBookingForm) where we enter clients booking orders. On this form we also have our employees details and details of clients order. I would like to know if it is possible that by clicking a command button selected information (fields) could automatically be sent as an attachment to the employee's email address which is also available on the same form.

    At the moment, I already have a command button which opens a report with the required information from the said Form, but we have to manually save the report on the desktop or printpdf it and then send it as an attachment. As you know all of this involves a few manual steps.

    These are the current fields I would be included on the report and sent to the employee's email address:

    1- ClientID
    2- EmployeeID
    3- BookingID
    4- ClientJobReferenceNumber
    5- NoOfHoursBooked
    6- RequestMadeBY
    7- Contact Number
    8- OrderTypeID
    9- DateOfJob
    10- TimeOfJob
    11- VenueID
    12- CustomersName


    By the way, this is the code which captures the required information on the report which we then manually email to employees.

    Private Sub CmdPrintOrdersheet_Click()
    Dim strReportName As String
    Dim strCriteria As String

    If NewRecord Then
    MsgBox "This record contains no data. Please select a record to print or Save this record." _
    , vbInformation, "Invalid Action"
    Exit Sub
    Else
    strReportName = "OrderSheet7"
    strCriteria = "[id]=" & Me.Id

    DoCmd.OpenReport strReportName, acViewPreview, , strCriteria

    End If
    End Sub
    Any help and ideally a code for this function would be highly appreciated.
    Emi-UK
    Love begets Love, Help Begets Help

  2. #2
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Take a look at the help for 'SendObject' and see if that does what you need.

  3. #3
    Join Date
    May 2006
    Posts
    386
    Hi Rogue,
    Thank you for your response. I have actually looked into this but this can only send text only and does not generate the required information on a report or send it as an attachment.

    Any help would be extremely and highly appreciated
    Emi-UK
    Love begets Love, Help Begets Help

  4. #4
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    SendObject allows you to send a snapshot of the actual report.

    SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile)

    ObjectType = acSendReport
    ObjectName = name of your report
    OutputFormat = acFormatSNP

  5. #5
    Join Date
    May 2006
    Posts
    386
    Hi Rogue,
    Thank you for your continued support on this. but we do not want to send a snapshot of the form but the report. the button that I click which opens a report with all the data captured from the form, and that is the report I would like to be sent to that employee's email address as a PDF file as soon as I click on the Email Worksheet Button.

    Or if not PDF, then I would like to be able to add another text and an SNPviewer.exe file so that anyone who does not have a SNP viewer could simply download it from the link that I would like to be added with the standard email.

    Thank you for your continued support.
    Emi-UK
    Love begets Love, Help Begets Help

  6. #6
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    If you need a pdf, we'll need a bit of information.....

    What pdf writer will be used?

    What email program will be used?

    What version of Access will be used?

  7. #7
    Join Date
    May 2006
    Posts
    386
    Thank you Rogue,

    The PDF writer that will be used is called DeskPDF
    Email program will be Ms Outlook 2002
    We are using Access 2002

    Thank you very much.
    Emi-UK
    Love begets Love, Help Begets Help

  8. #8
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634

  9. #9
    Join Date
    May 2006
    Posts
    386
    Thank you rogue,
    I have been following the instructions given in the above link, I am unable to find the Debug window within an access Module. Basically the last instruction by Microsoft after writing the code in a module says,
    To test this procedure, type the following line in the Debug window, and then press ENTER.
    SendMessage True, "C:\My Documents\Customers.txt"
    But I dont know where is the Debug window in a module, I copied and pasted it in the Immeidate Window and after I click on Debug/Compile nothing happens and when I click on Run, it asks me for module name.

    Any help would be much appreciated.
    Emi-UK
    Love begets Love, Help Begets Help

  10. #10
    Join Date
    May 2006
    Posts
    386
    sorry, I followed the instructions given by Microsoft Office and it worked up to the point where I pasted this code
    SendMessage True, "C:\My Documents\Customers.txt"
    in the Immeidate/Debug window of the module and pressed Enter then it opened Outlook email with an attachment (Customers.txt file) with some a name into To and Cc and Bcc.

    However, I dont know how to automate the whole process so after clickon on the command button it should actually covered the report with the data that appers on the form and then send it to the email address of the employee whose detail appears on that particular booking order.

    Your kind sep by step information and guidance would be highly appreciated.
    Emi-UK
    Love begets Love, Help Begets Help

  11. #11
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    The first thing you need to do is create the pdf file. I haven't used DeskPDF, but it sounds like the link in the other thread is not dependent on your pdf writer.

    Are you able to create the pdf?

  12. #12
    Join Date
    May 2006
    Posts
    386
    that is correct, the link you provided that not say much except to copy and paste the two DLL files into windows/system32 folder which i did. I am stuck now and do not know my way foreward. Please kindly help me sort this one out.
    Emi-UK
    Love begets Love, Help Begets Help

  13. #13
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    There is also a file named A2000SnapshotToPDFver785.mdb that has the code and a couple of forms. Take a look at the forms and give it a try.

  14. #14
    Join Date
    May 2006
    Posts
    386
    Thank you for that, I did not realise that I had download the MDB file as well, I will go through the codes and will update you accordingly. Thank you so much.
    Emi-UK
    Love begets Love, Help Begets Help

  15. #15
    Join Date
    May 2006
    Posts
    386
    Ok Rogue,
    I have gone through the MDB file and I could see the code but when I pasted it on my form it did not work, first it gave me a compile error on Me.Booking7 which is in bold :

    Dim blRet As Boolean
    ' Call our convert function
    ' Please note the last param signals whether to perform
    ' font embedding or not. I have turned font embedding ON for this example.
    blRet = ConvertReportToPDF(Me.Booking7, vbNullString, _
    Me.Booking7.Value & ".pdf", False, True, 150, "", "", 0, 0, 0)
    ' To modify the above call to force the File Save Dialog to select the name and path
    ' for the saved PDF file simply change the ShowSaveFileDialog param to TRUE.
    Please note that Booking7 is the name my report which I would like to convert to PDF and automatically appear as an email attachment with some alreay starndard written text and subject on the email.
    Emi-UK
    Love begets Love, Help Begets Help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •