Hey I am so close from finishing this database I just need one more issue solve thanks. Basically I have a code within a form that opens up outlook and fill in the body of the email, among other informations, with event infos, but I need it to also fill in the Venue. The problems is the venue exist in the form as a subform, and I don't know how to reference it in the code. Here is the code I hope you can help, I ran into so much problems trying to finish this database, mostly technical, and my teacher never used outlook object so he couldn't help. But at this point I just want to get this done. Thanks for your help, I basically want the reference at the .Body area.
Private Sub Command31_Click()
On Error GoTo Err_SendEmail
Dim objOutlook As New Outlook.Application
Dim objMail As Outlook.MailItem
Dim sSQL As String, db As DAO.Database, rs As DAO.Recordset
Dim sTitle As String, sFile As String, sErr As String
'Prelims
DoCmd.SetWarnings False
DoCmd.Hourglass True
Set db = CurrentDb
'Prepare email message
Set objMail = objOutlook.CreateItem(olMailItem)
With objMail
'Build recordset on recipients
sSQL = "SELECT [EMAIL_ADDRESS] FROM MEMBER_CONTACT;"
Set rs = db.OpenRecordset(sSQL)
'Add Recipient
While Not rs.EOF
With .recipients.Add(rs![EMAIL_ADDRESS])
.Type = olTo
End With
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
'Add the subject
.Subject = "Multi-Asian Club Event: " & Me![EVENT_NAME]
'Add standard message text to body
.Body = .Body & "Event Name: " & Me![EVENT_NAME] & vbCrLf
.Body = "Description: " & Me![EVENT_DESCRIPTION] & vbCrLf
.Body = .Body & "Event Date: " & Me![EVENT_DATE] & vbCrLf
.Body = .Body & "Start Time: " & Me![START_TIME] & vbCrLf
.Body = .Body & "End Time: " & Me![END_TIME] & vbCrLf
'Closure
.Body = .Body & vbCrLf & "Regards" & vbCrLf & vbCrLf & "Your Club"
.Display
End With
'Send the mail message
Set objMail = Nothing
Set objOutlook = Nothing
Exit_SendEmail:
DoCmd.SetWarnings True
DoCmd.Hourglass False
Exit Sub
Err_SendEmail:
sErr = "Error " & Error & " / " & Err
MsgBox sErr, vbInformation + vbOKOnly, "Error on Email subroutine"
Resume Exit_SendEmail
End Sub