Forms & Subforms and email

  • Thread starter Thread starter Liam Kitson
  • Start date Start date
L

Liam Kitson

I have a main form which contains one subforms. All of the data is from
the same record. The main form contains the personals details and the
subform contains their order details. I would like to use a button which
would send that records (main form and subform details) in an email using
SENDOBJECT. However the SendObject sends the complete Orders table as an
attachment.

How can I send the single record as email??

Regards

Liam Kitson
 
You need to build a report that shows the main part, and the details part.

You can then convert whole complex mess to a word attachment (rtf).

Keep the format simple, and clean..as the rtf format export does NOT export
graphics and logos.

Then, in code you can lanuch the reprot to the ONE record you are viewing,
adn then launch the meail client.

strReport = "InvoiceEmail"

me.Refresh
DoCmd.OpenReport strReport, acViewPreview, , "id = " & mybookingid
Reports(strReport).Visible = False

strEmailName = Nz(Me.EmailName, "")
strBodyText = "Hello " & Nz(Me.FullName)
strSubject = "Invoice from Joe Tools Company"

DoCmd.SendObject acSendReport, strReport, _
acFormatRTF, strEmailName, , , strSubject, strBodyText, True
 
Back
Top