Here are two sub procedures that I use in a working system. I'm sure you can adapt them.
Code:
Sub NotifyOvernight()
On Error GoTo Error_In_Code
Const k_EMAIL As String = "@whatever.vic.gov.au"
Dim strEmailAdd As String, strSubject As String, strMessage As String
Dim strMsg As String
strMsg = strMsg & "An email will now be generated and sent to the Recommending Sub-Officer" & vbLf
strMsg = strMsg & "informing that member of the Overnight Booking." & vbLf & vbLf
strMsg = strMsg & "Microsoft Outlook will display a message advising that an email is attempting" & vbLf
strMsg = strMsg & "to be sent. Click 'YES' to continue."
MsgBox strMsg
strEmailAdd = Me.fld_ON_Recommend_Member & k_EMAIL
strSubject = "Notification/Request - Overnight car booking"
strMessage = strMessage & "Car : " & Me.fld_Car_ID.Column(1) & vbLf & vbLf
strMessage = strMessage & "Booked for overnight use by : " & Me.fld_Driver & vbLf
strMessage = strMessage & "From " & Me.fld_Date_From & " " & Format(Me.fld_Time_From, "hh:nn") & " to " & Me.fld_Date_To & " " & Format(Me.fld_Time_To, "hh:nn") & ". " & vbLf
strMessage = strMessage & "Reason : " & Me.fld_Reason & vbLf
strMessage = strMessage & "Key Code : " & Me.fld_ON_KeyCode & vbLf
strMessage = strMessage & "Garaged : " & Me.fld_ON_Garaged.Column(1) & vbLf
strMessage = strMessage & "Security : " & Me.fld_ON_Security.Column(1) & vbLf
strMessage = strMessage & "Special conditions : " & Me.fld_ON_SpecialConditions
SendMail strEmailAdd, strSubject, strMessage
Exit_Code:
Exit Sub
Error_In_Code:
MsgBox "NotifyOvernight() " & Err.Number & " " & Err.Description
Resume Exit_Code
End Sub
The following could easily be incorporated in the above.
Code:
Sub SendMail(pStrEmailAddress As String, pStrEmailSubject As String, pStrEmailMsg As String)
On Error GoTo Error_In_Code
'Provides the Send Mail automation
'EMAIL USER DETAILS & ATT REPORT
DoCmd.SendObject , , acFormatRTF, pStrEmailAddress, , , pStrEmailSubject, pStrEmailMsg, False, False
Exit_Code:
Exit Sub
Error_In_Code:
MsgBox "SendMail() " & Err.Number & " " & Err.Description
Resume Exit_Code
End Sub
Hope this helps.
Steve.