Email Report Using Info From Forms

  • Thread starter Thread starter dbain30
  • Start date Start date
D

dbain30

I am using Access 97. I've created a fom to list a series of
customers that when selected the user has the ability to create an
invoice. This will send the report as a .PDF file to Lotus Notes, our
email system, but the user then has to type in the email address to
send it to.

I have the email address as a field in the form. Is there an easy way
to have that information automatically transferred over to Lotus Notes
to eliminate that step?
 
Yes there is. Below is an event procedure I used that captures the email
address on the form. This procedure is called from the OnClick event and
uses the SendObject. (look below for this line
"=[Forms]![frmProjects1]![spac_email]". This is the expression I use.
[spac_email] is the name of the email field.

Private Sub EmailAgenda_Click()
On Error GoTo Err_EmailAgenda_Click

'The code below runs a macro that prevents users from sending the email if
'our case management file hasn't been updated

If [Forms]![frmProjects1]![CMFUpdated] = 0 Then
DoCmd.RunMacro "CMFUpdateReminder"
DoCmd.CancelEvent

Else

Dim stDocName As String

stDocName = "EditedAgendaReport1" 'This is the name of the report

DoCmd.SendObject acReport, stDocName, acFormatSNP,
"=[Forms]![frmProjects1]![spac_email]", "fema-1603-infra", ,
"FEMA-STATE-APPLICANT MEETING", "(The attachment is an MS Access Snapshot
format. If you don't have an MS Access Application, you can download the
free Snapshot Viewer from
http://www.microsoft.com/downloads/...3f-6d74-423d-8274-8b7e6313edfb&displaylang=en)"

DoCmd.RunMacro "EditedAgendaStateNotified" 'This is a macro that
disables 'the send email button once the email is sent

End If

Exit_EmailAgenda_Click:

Exit Sub

Err_EmailAgenda_Click:
DoCmd.RunMacro "EditedAgendaNotSent" 'This is a macro that warns users
when the email did not go thru
MsgBox Err.Description

End Sub
 
Back
Top