Populate email TO and SUBJECT

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a command button on a form used to email a report. Is it possible to
take information from the form to populate the TO and SUBJECT lines of the
email message? I'm using Lotus Notes 6.5.2.
 
DV said:
I have a command button on a form used to email a report. Is it possible to
take information from the form to populate the TO and SUBJECT lines of the
email message? I'm using Lotus Notes 6.5.2.

The following code works for me but I'm no expert. If used direct in a form,
you may be able to use StrTo=me.FieldName instead of using the DLookup

Private Sub SendEMailButton_Click()
On Error GoTo Err_SendEMailButton_Click

Dim stDocName As String
Dim StrTo As String
Dim StrSubject As String
Dim Pge As String

StrTo = DLookup("[E_Mail_Address]", "[Tbl_Contact]", "[Contact]='" &
Forms![Frm_General_Enquiries]![ContactCombo95] & "'")
stDocName = "Rprt_Quote_By_E_Mail"
DoCmd.SendObject acReport, stDocName, To:=StrTo, Subject:="Our Quotation
Ref " & Me.Reference_No

Exit_SendEMailButton_Click:
Exit Sub

Err_SendEMailButton_Click:
If StrTo = "" Then
MsgBox "You have NO E MAIL ADDRESS to send to???????"
Exit Sub
End If
MsgBox Err.Description
Resume Exit_SendEMailButton_Click

End Sub
 
Sorry should have warned you about text wrapping due to page size on here.

HTH Mike
 
DV said:
I have a command button on a form used to email a report. Is it possible to
take information from the form to populate the TO and SUBJECT lines of the
email message? I'm using Lotus Notes 6.5.2.

Microsoft Access Email FAQ - Lotus Notes
http://www.granite.ab.ca/access/email/lotusnotes.htm

Tony

--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top