473,396 Members | 1,707 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,396 software developers and data experts.

AUTOMATE EMAIL ADDRESS IN ACCESS?


I have an email macro setup (maybe I should go another way, but that
was the quickest at the moment...) and what I would like to do is
automate the "to" addressee of the email it generates for sending.

What I have is an email button that creates a report based on a
property address on a form (driven by a query which has criteria such
as forms!frmPROPERTY!address). That open form also has an email
address on it for the owner, and I would like that very same button to
also reference the email address on the form and automatically populate
the email when it opens (Outlook). Within the Access macro, I can
stipulate the subject line and the text and that works fine. How can I
get it to also reference the email address on the form?

Scott Baird

Nov 13 '05 #1
3 2546
Check this out.

http://www.peterssoftware.com/c_emfa.htm

Nov 13 '05 #2
Thanks, but not quite what I'm looking for. This allows me to send TO
the same person each time. In my scenario, each record has it's own
email address (one property, name, phone, email address, is on the
screen at a time). I need to be able to send to various email
addresses (whichever one is on the screen at the time) with a push of a
button.

I can declare my subject line. I can even declare a few lines of text.
How can I declare the desired email address based on the contact
person's email addy?

Nov 13 '05 #3
> Thanks, but not quite what I'm looking for. This allows me to send TO
the same person each time. In my scenario, each record has it's own
email address (one property, name, phone, email address, is on the
screen at a time). I need to be able to send to various email
addresses (whichever one is on the screen at the time) with a push of a
button.

I can declare my subject line. I can even declare a few lines of text.
How can I declare the desired email address based on the contact
person's email addy?


The routine below is in a database where each record has a subform datasheet
with a list of associated email addresses. Users can enter a comment after
each email address if desired like this:

so*********@somedomain.com # this is Joe's home email address

double-clicking on the email address in the datasheet opens and addresses an
email to that address. With a little code you can extend this to do other
things. A good site for reference is http://www.slipstick.com/

Private Sub E_mail_Addresses_DblClick(Cancel As Integer)
'Required reference: Microsoft Outlook 11.0 Object Library
On Error GoTo HandleErr
Dim strEmail As String
Dim olapp As Outlook.Application
Dim olmi As Outlook.MailItem
Dim j As String
Set olapp = GetObject(, "Outlook.Application")
strEmail = Me![E-mail Addresses]
j = InStr(1, strEmail, "#", 1)
If j Then strEmail = Trim$(Left(strEmail, j - 1))
Set olmi = olapp.CreateItem(olMailItem)
olmi.Recipients.Add strEmail
olmi.display
Exit_Here:
On Error Resume Next
Set olmi = Nothing
Set olapp = Nothing
Exit Sub
HandleErr:
Select Case Err.Number
Case 94 'Invalid use of Null
'(when double clicking on blank field)
Case 287
Case 429
'if the mail item we are creating is sent, it will not leave
'the outbox unless Outlook is open. To make sure messages
'are sent immedaitely, outlook is opened here if it is
'not already open.
Call Shell(modOffice.GetOutlookPath)
Set olapp = New Outlook.Application
Resume Next
Case Else
modHandler.LogErr "frm0Email", "E_mail_Addresses_DblClick"
End Select
Resume Exit_Here
End Sub
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Geoff Cox | last post by:
Hello Is it possibel to automate the access time allowed to a folder? I am using .htpasswd etc and would like to give say 0.5 hour access to users so that they can sample documents available on...
4
by: deko | last post by:
I have an address form in Access 2003 that contains the usual address information such as AddressLine1, AddressLine2, City, State, etc... I would like to put a button on this form that feeds the...
6
by: John Galt | last post by:
Does anyone have working code to send a fax from VBA using Outlook.Mailitem? I have tried some examples I have found and they all simply try to use the Fax number as an e-mail address. Thanks in...
4
by: Chris via AccessMonster.com | last post by:
I have the challenge of needing to automate table creation. It doesn't end there the tables have to be created from one table that looks something like this... Email ...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
5
by: TM | last post by:
I would like to write a little app in Visual Basic .net as an add-in to Outlook 2003 so that I can quickly get a list of contact names and email addresses, then when I click on a name or email...
15
by: Karl | last post by:
Hi all, I regularly use FTP to place Self Extracting Zip files on the web for remote users to update their datafiles. Works very nicely. I have automated the creation of the initial zip file (...
3
by: steverossiter | last post by:
Hi, This is pretty simple stuff but if anyone can point a novice in the right direction it would be appreciated. I have a bunch of URL's that point to files on the internet whose download I...
3
by: chiinook | last post by:
I have built a fairly simple database to manage contact information for about 300 clients. Some of these have requested that I send them our publications by email rather than post. I have created a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
Oralloy
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,...
0
agi2029
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,...

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.