Results 1 to 15 of 15
  1. #1
    George is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    295

    Sending emails without interruptions

    Hi I am using a form to send an email but part way in the process a message box pops up with 2 buttons labeled: Allow and Deny with some other information. I am forced to select allow in order for the send process to be completed.

    Is there a way to prevent this popup so that the process completes smoothly without interruptions?

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    are you using outlook objects or are you using some external method (CDONT?).

    Using MS outlook library you can suppress any confirmations about sending email.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    You must filter the code thru a 3rd party control called Redemption.
    google Redemption, outlook.
    it works, I use it.

  4. #4
    George is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    295
    Thanks. I am using only Outlook objects.

    Happy to hear that there is a means to suppress this message. Can you please tell me how?

    Ok I would try redemption.

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Code:
        Dim oApp As Outlook.Application
        Dim oMail As MailItem
        Dim sAttachment As String
        
        Set oApp = CreateObject("Outlook.application")
        
        Set oMail = oApp.CreateItem(olMailItem)
        With oMail
            .Body = "This is the body"
            .Subject = "BJA Service Related Information"
            .To = emailrecipient
            sAttachment = fldExportPath & fldExportFile
            .Attachments.Add sAttachment
            .Send
        End With
        
        Set oMail = Nothing
        Set oApp = Nothing
    This code is cut out of one of my databases and sends an email without requesting confirmation.

  6. #6
    George is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    295
    Thanks all.

    This code definitely works with ease exception for the attachment. Can you please give me an example of how the path for the attachment can be written.

  7. #7
    George is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    295
    Thanks all.

    This code definitely works with ease exception for the attachment. Can you please give me an example of how the path for the attachment can be written.

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    on the form that runs this code fldExportpath is set to a default value (=currentproject.path & "\in files\") and my file name is constant (it's just there for a visual reminder for the user and set to ="Data_Export.txt") the code just concantenates the two strings together.

    How you populate the string it is up to you. You can use file dialog options to pick a file/folder and have your process adopt it to make your code more flexible, it really depends on your business process.

  9. #9
    George is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    295
    Thanks.

    I am using the follow code but gets an error message saying: Runtime error 429 Active X component can't create this object.

    This is line of code is highlighted: Set oApp = CreateObject("Outlook.application")

    Dim oApp As Outlook.Application
    Dim oMail As MailItem
    Dim sAttachment As String
    Dim emailrecipient As String

    emailrecipient = "greneebb@yahoo.com"


    Set oApp = CreateObject("Outlook.application")

    Set oMail = oApp.CreateItem(olMailItem)
    With oMail
    .Body = "This is the body"
    .Subject = "Samuel Jackman Prescod Polytechnic"
    .To = emailrecipient

    sAttachment = CurrentProject.Path & "\george.doc\"


    .Send
    End With

    Set oMail = Nothing
    Set oApp = Nothing

  10. #10
    George is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    295
    Hi rpeare,
    Please ignore my previous reply. Actually my Outlook was corrupt.

    I however need a little bit more explanation in making the attachment. Now, I am opening and attaching a report, so it is not a file in a directory. I believe that the "\my file\" would be inappropriate in this case. Is that opinion correct? and can you recommend anything else?


    Thank in advance.

  11. #11
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I don't understand the question. The attachment function was not part of your original post so I do not know what your requirement is.

    Are you saying you want to export a report directly to email and NOT retain an original copy of the file?

    your code in post #9 isn't correct, if you had a file in your database directory with the name george.doc you do not want to include the \ mark at the end

    it would be:

    sAttachment = CurrentProject.Path & "\george.doc"

    then you would have to ADD the attachment to your email

    attachments.add sattachment

    before the .send command

  12. #12
    George is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    295
    Thanks again.
    I agree that the attachment was not part of my original post; however I was glad to know about it and I intend to use it in the future.

    You are correct that I want to export a report directly to email and NOT retain an original copy of the file. That really my original objective, but obviously it would be emailed as an attachment.

    Thank for the correction at post #9

    The rest seem clear to me.

  13. #13
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    the method I gave you won't work if you don't want to retain an electronic copy of the original unless you use it in conjunction with filesystemobjects to delete the file after you've attached it.

    you could try

    http://www.fmsinc.com/microsoftacces...endobject.html

    sendobject allows you to send a report/form/etc directly to an email, however, if I remember correctly, you can't attach more than one file where the method I gave you, you can add as many as your email server will allow in physical size of files.

    See the section "LIMITATIONS OF THE SENDOBJECT COMMAND"

    Pick the method that works best for all your issues, I've always found the example I gave you to be the more flexible.

  14. #14
    George is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    295
    Thanks. I have a better overall understanding of the scope and limitations of the sendobjects command which I was attempting to use. You have presented me with several options so I would get to work now. I think that I would save a copy of the report, then email it using the 1st option you gave, then I would go back and delete the save copy as I have no use for it.

  15. #15
    George is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    295
    Everything is now working fine.

    Thanks for your assistance

Please reply to this thread with any new information or opinions.

Similar Threads

  1. sending multiple emails wth vba
    By baronqueefington in forum Programming
    Replies: 2
    Last Post: 02-09-2015, 02:49 PM
  2. Sending Emails from Access via Outlook
    By Terry Lawson in forum Programming
    Replies: 3
    Last Post: 11-14-2014, 10:03 AM
  3. Sending multiple emails
    By Sephaerius in forum Database Design
    Replies: 4
    Last Post: 08-08-2013, 11:55 AM
  4. Sending Emails and VBA coding
    By lucy1216 in forum Programming
    Replies: 4
    Last Post: 05-20-2013, 05:57 AM
  5. Sending multiple emails
    By Petefured in forum Programming
    Replies: 0
    Last Post: 05-24-2011, 03:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums