Modules & VBA :: Automatically Loop And Send Email
Oct 18, 2013
I am setting up a database to track preventative maintenance required for testing equipment in our repair shop. Some of my associates would like to be able to send e-mail notifications via the database when maintenance is due. I set up a query to show the people who need to receive an e-mail and a query to show the maintenance each person needs to perform.
Each person will need to perform more than one maintenance step each time. I would like to get it so that the database will loop through the first query and generate one e-mail for each person. I would like the e-mail to list all the steps that person would need to do (as shown in the second query). I know this would require setting up loops and I'm afraid I'm not very good at writing loops.
I think this will need two loops. One to loop through the first query to see all the e-mails that will need generated and one to loop through the actions to be included in each e-mail. The person's name is included in both queries and can be used to set up a link between the two.
View Replies
ADVERTISEMENT
Aug 13, 2014
I have inventory database, in database there is "NextScheduledMaintenance" field.
I want access to send email automatically when scheduled maintenance date due.
View 7 Replies
View Related
Aug 14, 2014
I have inventory database, in database there is "NextScheduledMaintenance" field, I want access to send email automatically when scheduled maintenance date due.
View 1 Replies
View Related
Aug 2, 2013
I have this code (below) that loops through a recordset and sends appointments. It executes the queries correctly and sends all appointments in the table, but sends them only to the contacts listed in the first record of the query. How do I get it to loop the contact details?
Code:
Private Sub SchedFollowUp()
Dim rsFollow As DAO.Recordset
Set rsFollow = CurrentDb.OpenRecordset("SELECT * FROM Follow_Up WHERE HR_Approved = True AND Added_to_Outlook = False AND Cancelled = False;", dbOpenDynaset)
Dim rsEmployee As DAO.Recordset
[Code] ....
View 10 Replies
View Related
May 27, 2014
I am working on a database that will notify technicians if they have orders that have been placed on back order. The technician can enter two kinds of orders, one for a specific job and one to replenish the stock in his truck. My manager has asked that I create separate reports for each kind of order and e-mail them to the technician. Is there a way to program Access to send an e-mail with two separate attachments?
I would also like the e-mail to send without the user needing to click the Send button. Is that possible? The database will be sending twenty plus e-mails each time the button is pressed, and I would like to avoid needing the user to click the Send button that many times.
View 1 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
Aug 1, 2013
I have an Access 2010 database which has a table with several fields with the Hyperlink data type. Some of these hyperlinks reference files stored in a SharePoint database. I am relatively new to using hyperlinks. The task is to insert those hyperlinks into an email using VBA so that the recipient can just click on them to view the documents.
I have no problems with using VBA to create emails or to add attachments. My issue is with adding hyperlinks to the body of the email.
View 12 Replies
View Related
Jul 2, 2015
I have a several templates in outlook 2003 for my charity work.
All is OK if I send the odd one now and again, but the workload is increasing with more and more at any one time. However having seen various posts on here, I was thinking I could set something similar in Access as well as keeping track of the payments & deposits more easily.
I am fine with to, cc,bcc, body, subject etc, but what I need to do is SendUsingAccount, but 2003 does not have this property, it started with 2007.
As well as sending on that particular account I also need the signature linked to that account.
I could add that signature by code if I can get the correct account and for some reason the signature is not added.
I tried using SendOnBehalfOfName which works as far as the correct email address is used, but still uses my default a/c.
As an aside, my Outlook session would always be open, so I will use GetObject and not CreateObject method, but would like not to have the warning dialogue in Outlook pop up all the time.
View 14 Replies
View Related
Dec 9, 2014
I have this code here that sends an email out with all the needed info. The problem i ran into was that for my field "item" it is in a table called "test" and there can be more than one record in there. I just can't get it to loop and show me all of the records. Right now it shows me only the first record. Also it is showing the name of the table before the result so i am not sure what is wrong there...
Code:
Private Sub Command4_Click()
On Error GoTo Err_SendInfo_Click
Dim varTo As Variant
Dim varCC As Variant
Dim stSubject As String
[Code] ....
View 4 Replies
View Related
Jun 27, 2013
I am trying to loop through a query results to extract email addresses from a query result.
I have the following code
NameCriteria = Forms![MainMenu]![tbl_Course_Details]![Course_Name].Value
DateCriteria = Forms![MainMenu]![tbl_Course_Details]![Course Date].Value
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sqlStr As String
[Code] .....
If i run this in access as a query then it returns results but when i run in there then it says no current Record and i cant work out why?
Someone on another post said that sql uses US date format so i tried converting to us date and still no results?
View 6 Replies
View Related
Jan 15, 2015
With the code below , I send the report: “ESERT4H”, in email body. How I could add yet another report on the same body of the email ?
DoCmd.OutputTo acOutputReport, "ESERT4H", "HTML(*.html)", "D:Access empESERT4H.html", False, "", 0, acExportQualityScreen
Dim Out As Outlook.Application
Dim NS As Outlook.NameSpace
Dim Folder As MAPIFolder
Dim Mens As MailItem
[Code] ....
View 7 Replies
View Related
Feb 3, 2014
I'd like a command button to open Outlook and create a new email message with the To and Subject fields already populated with what I want, is there anyway to do this?
View 1 Replies
View Related
Aug 17, 2015
Is it possible to send an email from an access 2007 database with a category?
View 8 Replies
View Related
Apr 30, 2015
What I want to do is inset a html file into the body of the email . I have created a publisher file and saved as html ..say
C: estpub1.html
How do I get this in to the body ?
Code to date below (not the tidiest - but it works)
Private Sub Command0_Click()
Dim MyDb As DAO.Database
Dim rsEmail As DAO.Recordset
Dim OutApp As Object
Dim OutMail As Object
Dim strAttach1 As String
[Code] ......
View 9 Replies
View Related
Dec 17, 2013
I'm using ACCESS 2010. I have a form which is having a embedded word document. What I'm trying to do is i want to enable user to format a mail in the embedded word document which will contain rich text and screenshots then with a click of button an outlook mail should open and content of this document should be pasted there. Once user sends this email, I want to save content of embedded document in the database.
View 4 Replies
View Related
Jul 31, 2013
What is the best way to send a single email to multiple recipients?
View 14 Replies
View Related
May 30, 2014
I currently have two e-mail accounts on my computer. One is my default e-mail address with my name on it. The other e-mail account is a generic account with the department name.
I have a database set up to generate and send e-mails to our technicians notifying them when an order they placed gets put on back order. This database could possibly send twenty or thirty e-mails out each time it is run. My manager has requested that the database send the e-mails from the generic e-mail account instead of the default account. That way, when the field replies to the e-mail, they won't bombard my account.
Is there a way to tell the database which e-mail account to send an e-mail from?
I am currently using the below module to send the e-mails:
Option Explicit
Dim appOutlook As Outlook.Application
Dim namespaceOutlook As Outlook.NameSpace
Sub Outlook_SendMail(sEmailAddr As String, sEmailSubj As String, sEmailBody As String, Optional sAttach1 As String, Optional sAttach2 As String)
[Code] ....
View 2 Replies
View Related
Jan 4, 2014
Is there a way of doing the above? I have several distribution lists (some >100 recipients) defined in Outlook, and would like to use the Docmd. Send Object command to send messages to one or several of them. I cannot find a way of defining a distribution list as any of the To, Cc or Bcc parameters.
View 2 Replies
View Related
Nov 4, 2013
I am using Access 2007 and are a newbie.
I am using the following code (Sendobject) to create a PDF of a report and send it via email to a customer's email address.
Private Sub EmailWorkOrderQuote_Click()
On Error GoTo Err_EmailWorkOrderQuote_Click
Dim stDocName As String
Dim mFilename As String
Dim mEmailAddress As String
[Code] ....
It works fine except that the I want to to able to utilize the ability to send the email with either both the CC and BCC or either or neither as well.
I have a table called "My Company Information" that contains the email addresses for the CC and BCC. If I have values in these fields, everything works great! If I have no values in either of these fields, I get "Invalid use of Null"....
I want to be able to use either both CC and BCC, either CC or BCC, or neither used and it still work.
View 9 Replies
View Related
Dec 18, 2014
After I have run all my access queries is it possible to send a conditionally formatted excel worksheet all in access using vba?
View 1 Replies
View Related
May 24, 2014
I have created some code to get the records of a query and it puts them in the body of the email but it doesn't format it well for example the email looks like
James | halliwell | 31
Leanne | smith |27
Alexis | smith |8
I would like it to be in a table is this possible,
Code:
Public Function SendEmail()
Dim MyDB As DAO.Database
Dim rst As DAO.Recordset
Set MyDB = CurrentDb
[Code] .....
View 3 Replies
View Related
Mar 17, 2014
I have some code that takes from a query, an email address and sends out an email.Due the security warning that happens for each individual email, i want to create ONE email for all email address in the query and populate them to the BCC section of the sendobject.Here is the code that I currently use
Code:
Private Sub cmdSendEmail_Click()
Dim MyDB As DAO.Database
Dim rsEmail As DAO.Recordset
Dim sToName As String
Dim sSubject As String
Dim sMessageBody As String
[code]...
I want to populate the BCC field with multiple emails addresses seperated by ":" and send just one email.
View 4 Replies
View Related
Mar 19, 2014
I am trying to make an automation in order generate reports based on query ( person name,person email address ) , export them to a folder in PDF and then send them one by one to each person email address.
What is happening:
- the reports are generated and exported fine
- the email are sent to the right addresses but the first person receives the correct report , the second person receives the report from the first person plus its own report and so on.
Here is my code :
Private Sub MakeReportSendEmail_Click()
Dim MyDB As DAO.Database
Dim MyRS As DAO.Recordset
Dim strSQL As String
Dim strRptName As String
[Code] ....
View 14 Replies
View Related
Jun 5, 2015
I have Access 2013, Win 7, Outlook 2010 (32-bit).I want to send an email from Access, but not through Outlook. Instead I want to connect to an external SMTP server. I've found a few examples that doesn't work for me. With code including for example
Code:
Set ObjMessage = CreateObject("CDO.Message")
I get an "Error 429: Object can't be created in Active X-component" (My translation from Swedish).With code including this:
Code:
Dim oEMail As New CDONTS.EMail
I get "user defined type has not been defined" (my translation again).I have working code for sending email through Outlook, which works fine. But, Outlook adds a lot of span tags, making it impossible to read for certain screen readers used by visually impaired people, therefore I can't use Outlook.
I've tried to read up on the matter (CDO), and think that maybe the CDO library etc is not included on my computer?can I download it?
View 10 Replies
View Related
Nov 10, 2014
I have a subform in Continuous Records format (records displayed are determined by controls on the parent). I would like to create a button that prepares an email and copies the contents of that subform in to the body of an email message.
The email. I have a method to create a new email, set To, CC, Subject and even Message Text.
Code:
strTo = txtName
strCC = txtManager
strSubject = "Something"
strMessage = "Hi, please find below list of details from X Y and Z" & vbnewline & vbnewline
That all works. Thats fine
The Records: I have found ways to have them added as an attachment, either the the SendObject and OutputTo method but I would like the list of records to be converted to a text string so I can include it within my strMessage variable, not include it as an attachment.
Code:
strMessage = strMessage & "Subform Records to go here"...
View 7 Replies
View Related
Feb 9, 2015
I have two tables
1) has email address, and Store ID
2) has multiple records per store
I need to write a procedure to send a separate email to each store that contains the records found in table 2 ( excel format).
View 3 Replies
View Related