We help IT Professionals succeed at work.

send attachment with email in an ms access form

shieldsco
shieldsco asked
on
528 Views
Last Modified: 2017-03-06
I'm using the code below to send emails from access. I would like to add code to send the attachment from the access attachment field on the form.... see sample form attached

Dim rs As DAO.Recordset

'On Error Resume Next
 Set rs = CurrentDb.OpenRecordset("qryEmail_Reminder_RecordSet_Apps")
With rs
 If .EOF And .BOF Then 'IT MEANS THERE ARE NO RECORDS, WE ARE AT THE BEGINNING OF FILE AND END OF FILE (No Records found for this query.)
 MsgBox " No emails will be sent because there are no records from the query ‘Email_Reminder_RecordSet_Apps’ "
Else
 Do Until .EOF 'DO UNTIL END OF RECORDSET FILE

'THE NEXT LINE SENDS THE EMAIL MESSAGE

DoCmd.SendObject acSendNoObject, , , ![Send_Email], , , "New Application Access", "Hello " & ![Send_To] & _
", " & Chr(10) & "Please grant access to " & ![First_Name] & _
" " & ![Last_Name] & _
", " & ![User_Email] & _
" to the following application: " _
& Chr(10) & ![App_Site_Name] & Chr(10) & Chr(10) _
& Chr(10) _
& Chr(10) _
& Chr(10) _
& "Thanks, " & Chr(10) _
& "V hields" _
& Chr(10) _
& "DSPC"


.Edit
 ![Email_Sent_Date] = Now()
 .Update
 

 .MoveNext 'THIS MOVES TO THE NEXT RECORD IN THE RECORDSET
 Loop

End If
 End With





'CLEAN UP MEMORY AT END
 If Not rs Is Nothing Then
 rs.Close
 Set rs = Nothing
 End If

Open in new window

Capture.JPG
Comment
Watch Question

Infotrakker Software
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions