Mailing a report

XaloRichie

Registered User.
Local time
Today, 20:12
Joined
Jul 2, 2003
Messages
70
I've been trying to get this and am missing something. Reading others threads I get the idea that its possible to send a report using code something like this.

DoCmd.SendObject acReport, "CanInvs", snapshotFormat, "email@wherever.bla"

My debugger wont have it but i cant see whats wrong.
This code is in an event proc onclick, when the user cancels an invoice it mails myrecipient with details.


Is it also possible to mail say just one value from a form without having to create a report??

Thanks
 
XaloRichie said:
DoCmd.SendObject acReport, "CanInvs", snapshotFormat, "email@wherever.bla"
Code:
DoCmd.SendObject acSendReport, "CanInvs", "snapshotformat", "email@wherever.bla"

IMO
 
Almost

IMO spotted the "" missing but now I get a new message box appear so I have to click Send and I dont want the user to even know this is happening .

And if you don't mind another slight prob. after I click send Im getting this error Fr4om Outlook express.
"
The connection to the server has failed. Account: 'wanadoomail', Server: 'SMTPadsl.wanadoo.es', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket Error: 10061, Error Number: 0x800CCC0E"
 
You can use this code to send a snapshot if you are using Outlook...
Code:
Private Sub YourButton_Click()

      Dim EmailApp, NameSpace, EmailSend As Object

      DoCmd.OutputTo acOutputReport, "Report1", "snapshotformat", "C:\Temp\Report1.snp"
      
      Set EmailApp = CreateObject("Outlook.Application")
      Set NameSpace = EmailApp.getNameSpace("MAPI")
      Set EmailSend = EmailApp.CreateItem(0)
      
      EmailSend.To = "email@wherever.bla"
      EmailSend.Subject = "Your Subject Here"
      EmailSend.Body = "Hello," & vbCrLf & vbCrLf & "Attached is the latest Snapshot"
      EmailSend.Attachments.Add "C:\Temp\Report1.snp"
      EmailSend.Send
      
      Set EmailApp = Nothing
      Set NameSpace = Nothing
      Set EmailSend = Nothing

End Sub

IMO
 
Last edited:
I'm sorry IMO, but that doesn't work with Oulook Express.

I'm not working with an english version of OE, but it's a safety-setting in OE: Extra, Options, Safety, the first checkbox "warn me if other programs try to send e-mail" or something like that. Clear that checkbox and you'll not get that stupid messagebox.
 
Cheers Bert

That worked for me... I suppose it is too much that it's possible to uncheck that box programatically, using VBA?
 
Re: Cheers Bert

I suppose it is too much that it's possible to uncheck that box programatically, using VBA?
Yes it is, because it's a safety-setting for blocking virusses and unknown mailtraffic. If it could be set from VBA, the setting is not functional.
 

Users who are viewing this thread

Back
Top Bottom