Send hidden email

BarryMK

4 strings are enough
Local time
Today, 14:12
Joined
Oct 15, 2002
Messages
1,350
I'm emailing a report linked to a single record using the following code in the OnClose event of the form. Can this code be modified so it can be sent without the email form popping up for confirmation?

DoCmd.SendObject acSendReport, stDocName, acFormatRTF, " Doe, John", , , "Please review new compliment/complaint " & Me.CompID
 
Thanks Rak
After posting I played with it a bit more and came up with this which works. All I need to do is put back in the linkcriteria and that should do it. Cheers


DoCmd.SendObject acSendReport, "rptEmail", acFormatRTF, " Doe, John", , , "Please review new compliment/complaint ", , False

For those of us less gifted in VBA it's the 'False' that does it. To have the report pop up change it to 'True'
 
Last edited:
This works great! Only problem I have is that it prints all the records. How can this be avoided and only the current record printed?
Thanks
K
 
kedarj said:
This works great! Only problem I have is that it prints all the records. How can this be avoided and only the current record printed?
Thanks
K

Sorry kedarj I've been off sick so could not respond

You need to add the Link Criteria

DoCmd.SendObject acSendReport, " rptEmail ", acFormatRTF, " Doe, John", , , "Please review new Improvement No " & Me.IncidentID, , False


This bit '& Me.IncidentID' is my Link Criteria In my database IncidentID is the unique ID for the record and is a field on the form from which I'm sending the email. So replace with your own record identifier. In the design grid of the query that brings out the data for your report you also need to put this underneath your unique ID - [Forms]![yourformname]![YourID]
 

Users who are viewing this thread

Back
Top Bottom