473,324 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

how to send email from access form via outlook

what's the required code to send Email from access form and the record be attached?
to [contractorEmail]
cc [ContracHolderEmail]
Oct 28 '14 #1
3 1248
twinnyfo
3,653 Expert Mod 2GB
There are numerous methods to do this. What have you tried so far? We will not create the solution for you but are more than willing to troubleshoot any problematic code you may have.
Oct 28 '14 #2
ok
i used the the following code to send Email
i need to add cc and body of message from another record
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command88_Click()
  2.  
  3.  
  4.     Dim stWhere As String       '-- Criteria for DLookup
  5.     Dim varTo As Variant        '-- Address for SendObject
  6.     Dim stText As String        '-- E-mail text
  7.     Dim RecDate As Variant      '-- Rec date for e-mail text
  8.     Dim stSubject As String     '-- Subject line of e-mail
  9.     Dim stID As String            '-- The  ID from form
  10.     Dim stWho As String         '-- Reference to tblUsers
  11.     Dim stApprovedBy As String    '-- Person who approved Violation
  12.     Dim strSQL As String        '-- Create SQL update statement
  13.     Dim errLoop As Error
  14.  
  15.     '-- Combo of names to assign ticket to
  16.     stWho = Me.ApprovedBy
  17.     stWhere = "tblApprovedBy.ApprovedBy"
  18.     '-- Looks up email address from tblApprovedBy
  19.     varTo = DLookup("[email]", "tblApprovedBy", stWhere)
  20.  
  21.  
  22.     stSubject = ":: New Violation ::"
  23.  
  24.     stID = Format(Me.ID, "00000")
  25.     RecDate = Me.Date
  26.     '-- User who prepare violations
  27.     strUserName = Me.UserName.Column(1)
  28.  
  29.  
  30.     stText = "You have been recieved a new violation." & Chr$(13) & _
  31.              Chr$(13) & "Violation number: " & ID & Chr$(13) & _
  32.              "This Violation has been sent to you for Approval by: " & strUserName & _
  33.              Chr$(13) & "Received Date: " & RecDate & Chr$(13) & _
  34.              Chr$(13) & "This is an automated message." & _
  35.            " Please do not respond to this e-mail."
  36.  
  37.     'Write the e-mail content for sending to assignee
  38.     DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, -1
  39.  
  40.  
  41.  
  42. End Sub
Oct 28 '14 #3
twinnyfo
3,653 Expert Mod 2GB
Ahmedamer,

Please use the Code Tags when posting code.

Does this code work?

My guess is your code for:

Expand|Select|Wrap|Line Numbers
  1. stWhere = "tblApprovedBy.ApprovedBy"
  2.  varTo = DLookup("[email]", "tblApprovedBy", stWhere)
Will either produce an error or not return any results.

stWhere should be something like:

stWhere = "[ApprovedBy] = '" & stWho & "'"

Is there anything else you need help with on this code?
Oct 28 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jay McGrath | last post by:
Help - trying to send a simple text email with with as little user intervention. I am trying to create a button in my Access application that will automatically send a simple text email. It...
2
by: Fred | last post by:
Is there a good code sample, in C#, showing how to send eamil with attachment, from a Windows Form like 'Send To' in Word, that will pickup Contacts in Outlook/Exchange 2000. I have searched...
1
by: Mr T | last post by:
I know how to send email from Access and I know how to create a custom form in Outlook. but.... How do I put the email info from Access into the Outlook custom form ??? Dim MyDB As Database Dim...
5
by: Kosmos | last post by:
I have traveled the world and the seven seas and I have yet to come up with an answer to this question.... So I'm adding an attachment to an email from access... The following is the code: ...
0
by: dreamsoul620 via AccessMonster.com | last post by:
Hi all! I'm trying to set up an email application for my database. I tried linking to my Outlook address book, but when reading from the table, I receive an error message saying I need to restart...
1
by: burtell | last post by:
Previously, I wrote: I have designed an HTML form. The name of each element corresponds to a heading in an Access database on my computer. Is there a way for me to program the HTML form to send the...
1
by: pixie | last post by:
Hi. Access 2003. The database stores contract information. I have a query for each person that is responsible for contracts. The query checks to see if there are reports due either this week,...
6
by: dlblack | last post by:
I am using the following code to send emails with attachments from Access using Outlook. The code works fine if Outlook is already open and emails are sent as expected via Outlook. When Outlook is...
0
by: Leon H | last post by:
I probably read all possible articles on the discussion forums about how to send email programmatically from Outlook, so below is my code. Basically, it executes just fine without exceptions or...
0
by: minioberoi | last post by:
How we can get all Distribution List members in C#.net code behind so as to send mails to all those members.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.