Code adjust /Outlook Email / Access 2010

Valery

Registered User.
Local time
Today, 09:15
Joined
Jun 22, 2013
Messages
363
Hi,

I would like to update this coding so that the Outlook email window opens directly, with the document attached, and allows me to write a message and click Send... I also do not need to preview or view this document before it is included in the email.

---

Please note that the following coding was graciously given to me and I am not knowledgeable in VBA. As well, the first two lines are commented (just didn't want to lose them as they may be useful in another circumstance :)).

Code:
Private Sub CmdInfoClient_Click()
'DoCmd.RunCommand acCmdSaveRecord - These two lines sent an email directly
'DoCmd.SendObject acSendReport, "R_ClientsInfo", acFormatPDF, "[EMAIL="bb@hotmail.com"]bb@hotmail.com[/EMAIL]", , , "Client Info_" & Me.LastName & "_" & Me.FirstName, , False

DoCmd.OpenReport "R_ClientsInfo", acViewPreview, , "[Pat_ID]=" & Me![Pat_ID]
DoCmd.SendObject acSendReport, "R_ClientsInfo", acFormatPDF, "[EMAIL="vv@hotmail.com"]vv@hotmail.com[/EMAIL]", , , "Info Client - Relance " & Me.LastName & "_" & Me.FirstName, , False
End Sub

THANK YOU!!
 
To open Outlook change the last False to Ture. You can just comment out the first line to prevent it from opening. However, you will need to put the criteria in the Reports Record Source so it will only send the current one and not all of them.
 
Thank you Gina - you are a gem!

Can you - again - refresh my memory and tell me how to insert this link in the record source? How is it written? Does it go in the query or in the report's properties?
 
Thanks! :D

In the Record Source of your Report on the Criteria line you want to *filter* by place...

Code:
Forms![YourFormName]![TheFieldYourAreUsingToFilterBy]

Then when you do to send your Report it will only send the one you are filtering by depending on the record you are on.
 

Users who are viewing this thread

Back
Top Bottom