Modules & VBA :: Adding CC To Email
Jan 28, 2015
I am having troubles adding email addresses to my CC box in my email. I am able to get the emails to populate into the "To:" space. Now I know I have the DLookup accessing the same record, but how can I make it so the CC_List puts the emails into the CC of the email?
Code:
Dim DailyReport As Integer
Dim EmailRecipiantsList As String
Dim RecipiantName As String
Dim CC_List As String
[code]....
View Replies
ADVERTISEMENT
Jan 29, 2015
I have some code that takes data from my database and creates an email with it. It also creates a folder and a word document. In the email, I would also like to include the file path as a link instead of just the path that it puts there now. Is this possible to do?
Code:
Option Compare Database
Private Sub SendEmail_Click()
On Error GoTo Err_open_word_Click
Dim oApp As Object
Dim path As String
[Code] .....
View 1 Replies
View Related
Feb 7, 2014
I have been able to create code to send email for my ticket system but now have a need to add an additional recipient. I would prefer this recipient to be add in the CC field. This email address will come from its own table. I have tried to figure this out myself but I can't get anything to work for me . I am fairly new to VBA and all of my experience is just through trial and error (mostly error). I have attached my original code below ....
Private Sub cmdMailTicket_Click()
On Error GoTo Err_cmdMailTicket_Click
Dim stWhere As String '-- Criteria for DLookup
Dim varTo As Variant '-- Address for SendObject
Dim stText As String '-- E-mail text
[Code] ....
View 1 Replies
View Related
Aug 21, 2014
My situation is that , I have a sub for sending an email to a single client on the current form. Using a record set works fine, I now wish to have
.Cc email address which is not part of the Record set ." its to the department head". strEmailAddress = rst![clientEmail] & " ;" & somebody@ntlworld.com
My question is can I type the somebody email address as indicated in red in the above line? to enable the email to go to both addressees .
set DoCmd.SendObject , , acFormatRTF, clientEmail, _ , , strSubject, strEMailMsg, False, False?
I would prefer to use the Do Cmd SendObject is this is achievable
View 2 Replies
View Related
Jul 16, 2014
NameStr As String
I have made a name string
Now I would like to add the nameStr near "Dear " how can i do this?
strbody = "<H3><B>Dear [I want the placed nameStr here] </B></H3>" & _
bodyStr & _
"<br><br><B>Thank you</B>"
View 1 Replies
View Related
May 2, 2014
I have vba code set up to automate a query output to email with outlook. I am having issues with the "TO" field. I have tried different types of code, such as the following:
1) MyMail.To = MailList.Fields("EmailAddress")
2) MyMail.To = MailList.Fields("EmailAddress") & ";"
Both of these work, but the issue I am having is the "TO" field in the outlook message looks like this:
admin@blahblah#mailto:admin@blahblah#
Why my code is adding the email address twice, I need to get rid of the #mailto:admin@blahblah# but I do not know how or why it keeps adding that end part.
View 3 Replies
View Related
Jan 15, 2014
I have a form which has a button to email the data out in a standard email message.
Private Sub Command60_Click()
Dim MyDb As dao.Database
Dim rsEmail As dao.Recordset
Dim sToName As String
Dim sSubject As String
Dim sMessageBody As String
[code]...
This works well enough, however, FIELDS 11 through to 16 contain the venue address. This is all we ll and good if every field of the venue address is populated. here are times when not all of the fields are populated, for instance, the address might only be 5 lines.I know I can do this using IIf statements on a report, but how can i achieve the same thing for the email.
View 6 Replies
View Related
Jul 16, 2014
I have made a query with the name "Confirmation" and it is setup like this:
Name trainee Email Training
John John@mail.com Tr one
Mary Mary@mail.com Tr two
I also made a button in a report with the title "Send Mail" now is my goal that if i press that button automatically multiple e-mail message's will be generated with data from people in that query. So if click on that "Send Email" button i want two different mails messages generated that will be send to John@mail.com and Mary@mail.com with in the mail body their data.
View 13 Replies
View Related
Jan 19, 2015
I am currently using vb code to send an email in Access on the click of a button. I want the database user to be able to enter the recipient in a text box [ToEmail] which is on form [GroupStockProfiler]. However, I'm unsure how to put this into my code. I currently have the following which doesn't work (unless I put a specific email after 'To'):
Private Sub Command414_Click()
Const cdoSendUsingPickup = 1
Const cdoSendUsingPort = 2
Const cdoAnonymous = 0
[code]...
View 1 Replies
View Related
Aug 3, 2015
I have an automated email system (Lotus Notes) in a Access database I have created and am looking for the code needed to add up to 3 c.c addresses into an email prior to sending automatically.
The code I have to send the email to the To: individual is all working but what code I need to add and where for the c.c addresses of which there could be 1, 2 or 3. The control for To address is EmailTo = CustCopyEmail The controls for the 3 c.c emails are cc_EmailAddress, cc_EmailAddress1 and cc_EmailAddress2.
Here's the code I have:
Private Sub SEND_CC_Click()
' Set up the objects required for Automation into Lotus Notes.
Dim Maildb As Object 'The mail database.
Dim Session As Object 'The Lotus Notes session.
Dim MailDoc As Object 'The mail document itself.
Dim UserName As String 'The current users Lotus Notes name.
[code]....
View 8 Replies
View Related
Jan 29, 2013
I have a database too big to upload here at the moment, however i have a main data entry form that is based on more than one table, what i want to do is create an email form either as html or info point and have this form emailed out so that my colleagues can then fill in thus on its return add records to the database.
View 1 Replies
View Related
Jul 30, 2014
I am trying to work my way into putting the content of my report into the body of an e-mail. I have used the following code to do so but I keep on getting the error: "An Expression You Entered Is the Wrong Data Type for one of the Arguments"
Code:
Private Sub Command278_Click()
On Error GoTo ER
Dim db As Database
Dim rstOpenPurchaseOrders As Recordset
Dim strSQL As String
[Code] .....
View 14 Replies
View Related
Nov 8, 2004
Ok, I've run into two serious problems in testing, and another question that I'm hoping you guys can
help me solve. Below my questions is the code used for making the search query/email program.
Problem #1: In testing, this search program only is working for me for new data. Any data that I had
in the database prior to implimenting the program will not move past the search stage. In other words, I
will do a search, it will find the emails and bring them up in a box, I hit "OK" and it gets hung up and won't move on
to opening up a new Email with the addresses implemented. However if I enter new data in the database, say with a weird
name so its only bringing up the new entry and no old entry, it works fine and opens up the new email.
Problem #2: Items I would like to search like check boxes. Say I have a check box "Donor", this is listed in the database
as a 1 or 0. I can't have my boss searching 1 or 0. Is there a way to change this to, say, being recorded in the DB
as a Yes or No. That way he would check to search "Donor" and type Yes in the search box and this would search the DB
"Donor" column for "Yes" and bring up the results.
New Question: My boss and I reviewed the form as it is so far yesterday. He was asking if I could add a Print Labels option
in there. I'm wondering instead of adding another seperate search box and all that mess for a labels search print, can I rather
add two check boxes, one labeled "Print Labels" and the other labeled "Email". What this would do is depending on the check box
you selected it would either run the search and email like we have it, or clicking the other check box would run the search and print
labels.
Quote:
'Author: Michael Walts, but use it as you like'Important information! this code requires a reference to the Microsoft DAO object library
Option Compare Database
Option Explicit
Private Sub cmdEmail_Click()
'will hold the dynamic SQL query
Dim strSQL As String
'will hold the WHERE clause portion of our SQL query
Dim strWHERE As String
'will hold all the recipients of this message
Dim strRecipients As String
'the recordset we will use to get the emails of the records that match our criteria
Dim rst As DAO.Recordset
'if there is input in the search criteria, then we will run the query and send the e-mail
If txtSearch <> "" Then
'if you have more buttons, just add mosr cases (the value of the radio button
'= the Case number, so Value of the State radio button is 1, etc.)
Select Case opgSearch.Value
Case 1
strWHERE = "WHERE State = '" & txtSearch & "'"
Case 2
strWHERE = "WHERE City = '" & txtSearch & "'"
End Select
strSQL = "SELECT EMail FROM tblUser " & strWHERE
'run the query and get the results into the recordset
Set rst = CurrentDb.OpenRecordset(strSQL)
'Loop through the recordset and add all the EMails
Do While Not rst.EOF
strRecipients = strRecipients & ";" & rst!EMail
rst.MoveNext
Loop
'remove the first ; from the strRecipients
strRecipients = Right(strRecipients, Len(strRecipients) - 1)
MsgBox strRecipients
DoCmd.SendObject , , , , , strRecipients, "News Letter", txtBody, False
rst.CloseSet rst = Nothing
End If
End Sub
'stops a ' entered in the field from breaking the query
Private Function SQLSafe(safeMe As String) As String
SQLSafe = Replace(safeMe, "'", "''")
End Function
View 1 Replies
View Related
Nov 16, 2013
Sending email using VBA & HTML. I want send email from access. Message in body contains some text and table in HTML format. I need check if email was really sent or cancelled with user.
Code:
Set olApp = Outlook.Application
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
[Code] ...
I need some message (for example):
If error then
MsgBox "Email not sent"
Else
MsgBox "Email sent"
End If
View 2 Replies
View Related
Oct 22, 2013
I have created something from our transport department and need to set up so he can select a command button and email from a query, but where would I put the query details in the coding below
VBA used
Dim strSQL
Dim db As DAO.Database
Dim MailList As DAO.Recordset
Dim objOutlook As Outlook.Application
Dim objemail As Outlook.MailItem
Dim Subjectline As String
Dim BodyFile As String
[code]....
View 1 Replies
View Related
Jul 17, 2013
Using Access 2007 and Lotus Notes 8.5 ...I've got some code to output a report to email as an attachment: it looks like this
DoCmd.SendObject acSendReport, "rep09emailnotification", acFormatRTF, "(Recipients)", , , "email subject", "email body text", 0
For MOST of the people who use the database, this works fine, and they send the email with the RTF attachment which all the recipients can open - but for some users, it generates a .tmp file which if you 'Open' it is just a load of gobbledegook, but it you 'View' it looks ok - but is truncating the report.what could be causing Access 2007 to create .tmp files rather than .rtf?
View 5 Replies
View Related
Feb 14, 2015
I have the code below which creates an email to Outlook.
I would like to use CDO to email but can not figure out how to incorporate CDO code into this
Private Sub Command68_Click()
On Error GoTo Handler
If DCount("[dob]", "[cpp12q]") = 0 Then
MsgBox "There are no records to send"
[code]....
View 5 Replies
View Related
Feb 17, 2015
I have some code that will connect to a database and the analyst name from the table. the name is stored as "Peter Cetera" and it would need to change it to "Cetera, Peter", this way I can paste it inside outlook email (happens via vba).
I use the below code to catch the name from the database:
Code:
Sub FindAnalystInDatabase()
'Declaring the necessary variables.
Dim con As Object
Dim rs As Object
Dim AccessFile As String
[Code] ....
The first value returned is the BIN nr and the second is what is interesting form me.
View 6 Replies
View Related
Feb 11, 2014
I have the code for sending an email but I only want to send a single email when there are records in a query and only when the database is first opened.
I hadn't considered this in my design so what structural requirements would it require if any?
View 5 Replies
View Related
Nov 28, 2013
How to send an email using access but how to get the emails address that are in the active directory...
View 14 Replies
View Related
Jan 12, 2015
I'm working on a database for work that email's the current record after the form is completed. I have a attachment field in the table called Photo and some record's have a photo attached and other's don't. The code below works great with records that have a photo attached, but I get a path not found if I try to email a record that does not have a photo. I know that I need to put some form of code to check the photo field for a attachment, but I'm having a brain fade as to just what the code is.
Code:
Private Sub eMail_Report_Click()
Dim oFilesys, oTxtStream As Object
Dim txtHTML As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
[Code] ....
View 5 Replies
View Related
Dec 12, 2013
I have created a database that auto emails and works well, my problem now is that though there are multiple emails to send to it is only sending to the first one. The way I have set this up is I have created a qry to combine all emails using Allen Brownes concatrelated in below
Code:
SELECT DISTINCT Left([Copy Of tbl_Depot]![Depot],3) AS Port, ConcatRelated("[Copy Of tbl_Depot]![ContactEmail]","[Copy Of tbl_Depot]","[Copy Of tbl_Depot]![Port]=""" & Left([Copy Of tbl_Depot]![Depot],3) & """") AS Email
FROM [Copy Of tbl_Depot];
I then link this to an append qry which becomes my data source
Code:
INSERT INTO tbl_dptem ( [Empty Return Location], [Container], ContactEmail, DepotEmSent )
SELECT qry_emdepot1.[Empty Return Location], ConcatRelated("[qry_emdepot1]![Container No]+chr(13)+chr(10)","qry_emdepot1","[qry_emdepot1]![Empty Return Location]= """ & [qry_emdepot1]![Empty Return Location] & """") AS [Container], qry_Portem.Email, qry_emdepot1.DepotEmSent
FROM qry_Portem RIGHT JOIN qry_emdepot1 ON qry_Portem.Port = qry_emdepot1.[Empty Return Location]
GROUP BY qry_emdepot1.[Empty Return Location], qry_Portem.Email, qry_emdepot1.DepotEmSent;
Below is the code I use to auto send emails and when I check it shows all email addresses in sent email but it is only going to the first recipient.. not sure what I need to do so all of them get it.
Code:
Sub EmDepot()
Dim Notes As Object
Dim Maildb As Object
Dim MailDoc As Object
Dim objNotesDocument As Object
Dim objNotesField As Object
[code]...
View 4 Replies
View Related
Dec 16, 2014
i am trying to send a email with a pdf-report attached based on a report (rap_factuur_klant_pdf).I am using MS Access 2007 and Outlook 2007..
Code:
Dim sAddr As String, sSubj As String, sFor As String
Again:
sAddr = InputBox("E-mail address:")
sSubj = "Report"
sFor = Left(sAddr, InStr(1, sAddr, "@") - 1)
DoCmd.SendObject acSendReport, rap_factuur_klant_pdf, acFormatPDF, sAddr, , , sSubj, "BLA BLA BLA"
DoEvents
View 5 Replies
View Related
Dec 13, 2013
I'm using 2013. The first version of my code works great. It opens the correct report and attaches it to an e-mail as a pdf with all of my text etc.
Code:
Private Sub btnEMail_Click()
On Error GoTo errHandler
Dim strReport As String
Dim vMsg As String
Dim vSubject As String
Dim strWhere As String
strReport = "RptJobDSD"
[Code] ....
The problem I have is I would like to rename the pdf, so instead of "RptJobDSD" everytime, it can have some fields [DSDDate] and [JobID] etc.
Before trying the fancy field stuff I thought I'd try just "DSD Test" and see if I could rename it in the first place!
I added this and am getting - Error(32004) - The control name 'RptJobDSD' is misspelled or refers to a control that doesn't exist.
Code:
DoCmd.OpenReport strReport, acViewPreview, , strWhere
DoCmd.SetProperty strReport, acPropertyCaption, "DSD Test"
DoCmd.SendObject acSendReport, strReport, acFormatPDF, , , , vSubject, vMsg, True
My confusion comes as the OpenReport and SendObject recognise strReport why doesn't SetProperty?!
View 2 Replies
View Related
Feb 23, 2015
I want to create a button on my form so that once I have entered results of an Audit into the form, I want to be able to press the button to send the manager an email stating the Audit Observation Record ID to action.
View 6 Replies
View Related
Jun 25, 2013
I use a macro (SendObject), which works, but it requires Us, or someone to go into Outlook to click on send.I'm new to vba, do I have to code something on outlook to send automatically?
View 6 Replies
View Related