Question Email Discussion

PNGBill

Win10 Office Pro 2016
Local time
Tomorrow, 02:11
Joined
Jul 15, 2008
Messages
2,271
Hi Forum, access 2010
I use two email methods.

Outlook OM
eg
Code:
         'Create variables for Outlook Mail
    Dim MyOutlook As Outlook.Application            'An Outlook Application
    Dim MyMail As Outlook.MailItem                  'An Outlook Mail Item
     
        'Open Outlook
    Set MyOutlook = New Outlook.Application
    Set MyMail = MyOutlook.CreateItem(olMailItem)
    
    MyMail.To = varTo
    MyMail.CC = "Loans"
    MyMail.Subject = stSubject
    MyMail.Body = stText
  '  MyMail.Attachments.Add "W:\Attachments\" & FullName & " Loan Statement " & TeamMember & ".pdf", olByValue, 1, "Statement"
    MyMail.Importance = MailImportance
  '  MyMail.Send
    MyMail.Display
    
    Set MyOutlook = Nothing
    Set MyMail = Nothing

The other method is DoCmd.SendObject
eg
Code:
DoCmd.SendObject , , acFormatTXT, varTo, "Loans", , stSubject, stText, -1

With Outlook OM we can attach a file but the system does not pickup an email failing to be sent.

With SendObject, I can not see how to attach a .pdf file.
The code does pickup a failure of an email to be sent..

Is it possible to attach files with SendObject ?:confused:

I understand Outlook OM can beaware of an email failure to be sent if you have additional code to look for outlook error messages.

On another issue, can DoCmd.SendObject be the method to transfer data from one database to a remote database ??:confused:

If we have a tblAudit which records all changes to our database can DoCmd.SendObject email this table to a remote database and allow the two databses to then have the same records ?:confused:

Appreciate any advice:)
 
I think I understand a bit more re the SendObject facility.

SendObject can only send an Object of Access as an Attachment but not a File that is residing somewhere on your hdd.
SendObject can produce a Report and send it by email as a .pdf (ms access 2010 version).
If the report requires a filter, I will have to have this built into the Open Event of the report by way of Public Variable / TempVars.

Assuming you only have One report to attach then SendObject, along with Public Variable, can do the task.
 
Here's a paper we've written that discusses the features and limitations of the Microsoft Access Docmd.SendObject command: fmsinc.com/MicrosoftAccess/Email/SendObject.html

We also offer a commercial product, Total Access Emailer, that lets you send personalized emails to your contact lists, including filtered attachments from your reports. Free trial here: fmsinc.com/MicrosoftAccess/Email/free-trial.html

Hope this helps.
 
Hi

You could try the cdo method. I believe you can attach to it and it doesn't use sendobject or outlook. I have a demo module that I made. I'll dig it out and send you for FREE....


Admin,

A 10 poster user advertising their products? Didn't realise this was a classifieds lol


Nidge
 

Users who are viewing this thread

Back
Top Bottom