Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 21st, 2017, 10:41 AM
marcyharris61 marcyharris61 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2016
Posts: 3 marcyharris61 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 58 sec
Reputation Power: 0
Email from Access 2010 using Outlook

Hi, I'm new to this part of access but what I am trying to accomplish if possible is the following:
I am having a problem with the code below. When I first put the code in it worked but only on the first record of the db. Today when I opened the db the code doesn't work at all. I don't get an error message the button that executes the code just sits with the outline around it in dashes and it doesn't do anything. When it was working when you hit the button it actually brought up the email and you had to hit send (which is what I want).

So why isn't the code currently working and why does it only work on the first record of the db.

And can I add criteria? Currently it is adding all of the task number names but I only want those added if the field ActiveCodes say "Request from Finance"

For example if the "ActiveWritingCode" field says "Request from Finance" I want the field "WriterTaskNumberName" in the body otherwise leave it blank.
Code:
Private Sub cmdEmail1_Click()
On Error GoTo cmdEMail_Click_Error

    Dim OutApp As Object
    Dim strEMail As String
    Dim OutMail As Object
    Dim strbody As String
    
    strEMail = Me.EMail
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    strbody = "Please add the following time codes to Oracle for Lilly Project 1000814. Thank you!" & vbCrLf _
            & "" & vbCrLf & "INSTRUCTIONS:" & vbCrLf _
            & "" & vbCrLf & "Make sure the Task Description starts with CO3. This is automatically added by entering CO3 in the Contract field on the form." & vbCrLf _
            & "" & vbCrLf & "If you wish to keep track of your time code requests, CC: yourself on the e-mail and considering entering a compound name or other identifier in the subject line. Alternatively, save a copy of the spreadsheet with your time codes to your desktop." & vbCrLf _
            & "" & vbCrLf & "WRITING TASK NUMBER NAME =" & [Forms]![frm_Regulatory]![WriterTaskNumberName] & vbCrLf _
            & "" & vbCrLf & "ADD DRAFT TASK NUMBER NAME =" & [Forms]![frm_Regulatory]![AddDraftTaskNumberName] & vbCrLf _
            & "" & vbCrLf & "EDIT TASK NUMBER NAME =" & [Forms]![frm_Regulatory]![EditTaskNumberName] & vbCrLf _
            & "" & vbCrLf & "QUALITY REVIEW TASK NUMBER NAME =" & [Forms]![frm_Regulatory]![DataIntegrityQRTaskNumber] & vbCrLf _
            & "" & vbCrLf & "Task Description =" & [Forms]![frm_Regulatory]![Text186] & vbCrLf

    On Error Resume Next
    If Me.ActiveWritingCode = "Request from Finance" Then

    With OutMail

        
        .To = strEMail
        .CC = ""
        .BCC = ""
        .Subject = "Lilly US 1000814 Time Code Request"
        .Body = strbody & vbNewLine & .Body
    .Display
   
    End With
    
    Set OutMail = Nothing
    Set OutApp = Nothing
    End If

    On Error GoTo 0
    Exit Sub

cmdEMail_Click_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdEMail1_Click of Sub Form_frm_Regulatory"

End Sub

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Email from Access 2010 using Outlook


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap