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