View Full Version : Delete exports when finished


Timoty
08-07-2003, 09:00 AM
Is there anyway to delete my exports once they are emailed from within access. The code so far is as follows:

Dim stDocName As String
Dim EmailApp, NameSpace, EmailSend As Object

DoCmd.OutputTo acReport, "rescasdir", acFormatRTF, "h:\Resolved.rtf"
DoCmd.OutputTo acReport, "bordir", acFormatRTF, "h:\Border.rtf"
DoCmd.OutputTo acReport, "othagdir", acFormatRTF, "h:\Other.rtf"


Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.getNameSpace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)

EmailSend.To = "my name"
EmailSend.Subject = "Court Updates"
EmailSend.Attachments.Add "h:\border.rtf"
EmailSend.Attachments.Add "h:\other.rtf"
EmailSend.Attachments.Add "h:\resolved.rtf"
EmailSend.Display

Set EmailApp = Nothing
Set NameSpace = Nothing
Set EmailSend = Nothing

dcx693
08-07-2003, 09:41 AM
Investigate the scary-sounding Kill command.

yippie_ky_yay
08-07-2003, 09:45 AM
Hey Timoty,

you can use either the "Kill" or DoCmd.DeleteObject .

Hope that helps!

-Sean

Timoty
08-07-2003, 12:53 PM
The KILL command worked for me. Boy could I have fun with that command =-)

dcx693
08-07-2003, 12:56 PM
I know, couldn't they have called it DeleteFile or something more benign sounding? "Kill" sounds so....final.

SilentBreaker
08-07-2003, 05:19 PM
The use of Kill command is a bit dangerous !!!!

You could use this below statements without a harm way.


DoCmd.SendObject acSendReport, _
"rescasdir", acFormatRTF, _
"my name", , , _
"Court Updates", _
"Please open the attachment file", _
False


This will send the email with an attachment file automatically, without doing the Kill file.

Cheers :)

Timoty
08-08-2003, 05:17 AM
Silent breaker....I wanted to try to avoid exporting the files and your idea is great, except for the fact that I have to send all three reports as attatchments to one email. After searching this forum endlessly it seems that there is no other way to attatch three reports to one email.

If anyone knows another way than What I've done I'd be thrilled to hear about it.