If you have an Access database with a list of contacts and emails, watch this tutorial to learn how to add a form so you can email them and (optionally) include an attachment.
http://www.researchtutorials.com/videos/dm/emailform5.flvResources Mentioned in this Tutorial
Code you can Copy and Paste
In the tutorial, I made some changes to the original e-mail form. If you want to make these same changes, here is the code in case you want to copy and paste it (in place of the corresponding code in your form). The changes I made are highlighted in red.
Private Sub cmdEmail_Click() On Error GoTo Err_cmdEmail_Click Dim strDocName As String Dim strEmail As String Dim strMailSubject As String Dim strMsg As String 'strDocName = Me.lstRpt strEmail = Me.txtSelected & vbNullString strMailSubject = Me.txtMailSubject & vbNullString strMsg = Me.txtMsg & vbNullString & vbCrLf & vbCrLf & "Your Name" & _ vbCrLf & MailTo: youremail@nowhere.com If IsNull(Me.lstRpt) Then DoCmd.SendObject To:=strEmail, Subject:=strMailSubject, _ MessageText:=strMsg Else DoCmd.SendObject objecttype:=acSendReport, _ ObjectName:=Me.lstRpt, outputformat:=acFormatHTML, _ To:=strEmail, Subject:=strMailSubject, MessageText:=strMsg End If Exit_cmdEmail_Click: Exit Sub Err_cmdEmail_Click: Select Case Err.Number Case 2501 Resume Next Resume Exit_cmdEmail_Click Case Else MsgBox Err.Description Resume Exit_cmdEmail_Click End Select End Sub



Mon, Jul 20, 2009
Data Management