I have VB code that will create an email but it leaves the email address blank. I want it to pick up the Email Address from the field 'Email Address' in the query 'July Donations to Missions' which is the source of the information in the Report 'July Transfer Email (Reprint)'. I am not very proficient with VB and need some help. I have tried various things to specify the value of strEmail but so far unsuccessfully. Can someone tell me what is required please? My code is
Private Sub Command59_Click()
Dim varItem As Variant 'Selected items
Dim strWhere As String 'String to use as WhereCondition
Dim strDescrip As String 'Description of WhereCondition
Dim lngLen As Long 'Length of string
Dim strDelim As String 'Delimiter for this field type.
Dim strDoc As String 'Name of report to open.
Dim db As Database
Dim rs As DAO.Recordset
Dim ToVar As String
Dim sql As String
Dim strEmail As String
strDelim = """" 'Delimiter appropriate to field type.
strDoc = "July Transfer Email (Reprint)"
strEmail=?????
DoCmd.OpenReport strDoc, acViewPreview, WhereCondition:=strWhere, OpenArgs:=strDescrip
DoCmd.SendObject acSendReport, strDoc, acFormatPDF, strEmail, , , "Payment from Bangor Worldwide Missionary Convention", "Attached is a copy of the Email attachment sent to you earlier when we transferred money to your Bank account. ", True
DoCmd.Close acReport, strDoc
DoCmd.Close acReport, strDoc
End Sub