ajc 1
New Member
Wondering if its possible to link a table with e-mail addresses in it, with an e-mail package, sending out a standardised e-mail to certain people within the database table.
Many Thanks
ajc
1 1356
Yes it is, you can send through outlokk. Here's some sample code, you'll need to modify it to suit. - Public Sub SendOutlookMessage( _
-
strEmailAddress As String, _
-
strEmailCCAddress As String, _
-
strEmailBccAddress As String, _
-
strSubject As String, _
-
strMessage As String, _
-
blnDisplayMessage As Boolean, _
-
Optional strAttachmentFullPath As String)
-
-
'* Copy this code and paste it into a new Access
-
'* Module. Click Tools > References and make sure
-
'* that "Microsoft Office Outlook x.0 Object Library"
-
'* is checked.
-
'*
-
'* This subroutine sends an e-mail message through
-
'* MS Outlook. If the "blnDisplayMessage" parm is
-
'* set to "False", the message is placed in the
-
'* Outlook Outbox. "True" displays the message, and
-
'* user will have to click "Send" to send it.
-
'*
-
'* Ex.:
-
'*
-
'* SendOutlookMessage _
-
'* "john@doe.com", _
-
'* "ccJane@doe.com", _
-
'* "bccSue@doe.com", _
-
'* "Subject", _
-
'* "Body of Message", _
-
'* False, _
-
'* "C:\My Documents\MyAttachmentFile.txt"
-
-
Dim objApp As Outlook.Application
-
Dim objOutlookMsg As Outlook.MailItem
-
Dim objOutlookRecipient As Outlook.Recipient
-
Dim objOutlookAttach As Outlook.Attachment
-
Dim blnOutlookInitiallyOpen As Boolean
-
Dim strProcName As String
-
-
On Error Resume Next
-
strProcName = "SendOutlookMessage"
-
-
blnOutlookInitiallyOpen = True
-
Set objApp = GetObject(, "Outlook.Application")
-
If objApp Is Nothing Then
-
Set objApp = CreateObject("Outlook.Application")
-
'* Outlook wasn't open when this function started.
-
blnOutlookInitiallyOpen = False
-
End If
-
If Err <> 0 Then Beep: _
-
MsgBox "Error in " & strProcName & " (1): " _
-
& Err.Number & " - " & Err.Description: _
-
Err.Clear: _
-
GoTo Exit_Section
-
-
'Create the message
-
Set objOutlookMsg = objApp.CreateItem(olMailItem)
-
If Err <> 0 Then Beep: _
-
MsgBox "Error in " & strProcName & " (2): " _
-
& Err.Number & " - " & Err.Description: _
-
Err.Clear: _
-
GoTo Exit_Section
-
-
With objOutlookMsg
-
Set objOutlookRecipient = .Recipients.Add(strEmailAddress)
-
objOutlookRecipient.Type = olTo
-
If strEmailCCAddress = "" Then
-
Else
-
Set objOutlookRecipient = .Recipients.Add(strEmailCCAddress)
-
objOutlookRecipient.Type = olCC
-
End If
-
If strEmailBccAddress = "" Then
-
Else
-
Set objOutlookRecipient = .Recipients.Add(strEmailBccAddress)
-
objOutlookRecipient.Type = olBCC
-
End If
-
.Subject = strSubject
-
.Body = strMessage
-
-
'* Add attachments
-
If Not IsMissing(strAttachmentFullPath) Then
-
If Trim(strAttachmentFullPath) = "" Then
-
Else
-
Set objOutlookAttach = .Attachments.Add(strAttachmentFullPath)
-
If Err <> 0 Then Beep: _
-
MsgBox "Error in " & strProcName & " (3): " _
-
& Err.Number & " - " & Err.Description: _
-
Err.Clear: _
-
GoTo Exit_Section
-
End If
-
End If
-
-
If blnDisplayMessage Then
-
.Display
-
Else
-
'* Send message by putting it in the Outbox
-
.Send
-
End If
-
End With
-
-
If Err <> 0 Then Beep: _
-
MsgBox "Error in " & strProcName & " (99): " _
-
& Err.Number & " - " & Err.Description: _
-
Err.Clear: _
-
GoTo Exit_Section
-
-
Exit_Section:
-
On Error Resume Next
-
If Not blnOutlookInitiallyOpen Then
-
objApp.Quit
-
End If
-
Set objApp = Nothing
-
Set objOutlookMsg = Nothing
-
Set objOutlookAttach = Nothing
-
Set objOutlookRecipient = Nothing
-
On Error GoTo 0
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Kona |
last post by:
Hello,
I would like to known if it is possible to limit acces to a UDB
database on Solaris system through db2connect to only specified
clients ?
My client is a db2connect on Windows platform.
Thank you
|
by: TTD_hck |
last post by:
Hello,
I need suggestions for the following.
I have a acces 97 database and with a script command in acces 97, I can
e-mail a file via outllok. I do this with the folowing command in Acces 97:
DoCmd.SendObject acReport, "overboeken uitgesneden", acFormatRTF,
"info@mailadres.nl" , , , " ret, uit" & Forms.......
This command worked fine with oulook 97. But since i installend outlook XP
|
by: gasturbtec |
last post by:
please help im new at access programming and i just got this project
dropped in my lap because the old programmer quit. i've been doing ok
so far but now i need to add code to an existing database that is used
to connect to other databases and generate reports. below is sample
code of how the database does the linking i hope i give you enough
info to help me but if not let me know and i will give more.
Sub txtShipDataFileSub()
Dim...
|
by: John Smith |
last post by:
I am currently using excel to manage a small database. The problem is
my database is getting big and I need more then the 65000 lines excel
can have.
I have considered access but it lacks some important built-in features
from excel. For exemple:
- Easily Add multiples similar entry with incremental numbers or lets
say the same line 40 times.
Ok lets say I have somes book numbered 1 - 500. Currently I don't know
|
by: Admir Hod?ic via AccessMonster.com |
last post by:
I use some old fashion program whit DBF files and now i step by step moving thth to acces. Problem occurs when i try to link DBF tables whit MEMO FILED wich requvest file whit ''name''.ftp extension whic reprezent that memo filed. That kind of DBF file i cant link or import. Anyone have fix for that is there any program to i can delete that filed before i link table or is there any good option for that.
thanx a lot sory on my bed english
--...
| |
by: Mrozu |
last post by:
Hi
I have frm1. On this form button.Click code for this
button is:
Dim frm2 as New frm2
frm2.show
So after click, frm2 form is shown.
|
by: tomPee |
last post by:
Hi,
I have the following problem:
I am trying to make some sort of base class menu that i can then use to derive other menu's from. Those menu's should then be able to interact with each other.
And, i have most of the idea figured out and I thought out how i want to do it. But when i started coding i found a slight... difficulty.
It might be easy to overcome, but google let me down :( and my own imagination made one happy jump, but...
|
by: throwerm72 |
last post by:
I currently have and Access DB that has imported/linked tables from a MySQL databse running on a server (using and ODBC connection). I need to link the another Access DB with the same tables to my existing Access DB (pulling from a MySQL server).
Essentially i am linking an existing Acces DB to and an Existing MySQL DB using another access db to join the two. Essetialy a user would be able to make change in the exsiting Access db which...
|
by: zaankanter |
last post by:
Hi,
This my problem.
After distribution of my acces-application I want the new user to be able to enter his Name-adress-etc values, in a one-row table called program-variables. These will be used tot print on reports etc.
I want this to be a one-time event. This will help to avoid illegal re-distibution.
My idea is that before updating the values ther is a check: are the fields null or not?
If not the action should be canceled.
In more...
|
by: bilalkhan |
last post by:
Hello
I m using MS Acces 2007, I need to create a form through which a user can enter all the parameter values in the form and these values will automatically picked by a query:
Here is the query which i want to link with a form
INSERT INTO ( , , , , , , , Cases, Premium, , )
SELECT ., ., ., ., ., ., ., .Cases, .Premium, ., .
FROM
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |