Sending e-mail to "current record"

  • Thread starter Thread starter Bob Loder
  • Start date Start date
B

Bob Loder

Hi, Braintrust!

You folks have helped me tremendously over the last couple of months, and I
hope you can help me one more time!

I have a relatively simple Db for use within my own company only (Win XP
Pro, Access 2k, 10 user lan).

I would "simply" like to offer the user the ability (from a command button?)
to open Outlook Express with the current records e-mail address filled in,
(the user can then complete and send there e-mail to the current record).

The e-mail address is captured in the field >fldEMailAddr< from
tblMainWorkInProgress<.
I've tried an "OnClick" event
=mailto:[tblMainWorkInProgress].[fldEMailAddr] (with and without table name)
to no avail, but it feels close!!

Additionally, I would like to be able to use another command button to open
the clients Web Page >fldWebAddr< also from >tblMainWorkInProgress<, and I'm
betting that the solution is similar!

I'm just starting to use VBA code (i.e. I've become an "expert" in cutting
and pasting code to the proper location <[ ; - ) - note the dunce cap!

Thanks again for your help.

Bob Loder
Tampa, FL

P.S. At the suggestion of these newsgroup members, I have purchased "Access
2000 Developers Handbook" and several others that were suggested. Somewhat
over my head at this point, but I'm hellbent on becoming the best "Access
Hobbiest" around! Not easy at 56 years old, but you'll see - I'll be
answering questions (giving back) in no time!
 
The following will work using MS Outlook, so give it a try and see what
happens with OE as your default email.

I would recommend that you put this code behind the On DoubleClick event of
a TextBox on a form, since I don't think you want the email program opening
with just a single click into the textbox. When working from a form, you'll
want to refer to the Control on the form rather than the underlying
table/query value.

Dim strEmail as String

strEmail = "mailto:" & Me.fldEMailAddr
Application.FollowHyperlink Address:=strEmail

hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX

Bob Loder said:
Hi, Braintrust!

You folks have helped me tremendously over the last couple of months, and I
hope you can help me one more time!

I have a relatively simple Db for use within my own company only (Win XP
Pro, Access 2k, 10 user lan).

I would "simply" like to offer the user the ability (from a command button?)
to open Outlook Express with the current records e-mail address filled in,
(the user can then complete and send there e-mail to the current record).

The e-mail address is captured in the field >fldEMailAddr< from
tblMainWorkInProgress<.
I've tried an "OnClick" event
=mailto:[tblMainWorkInProgress].[fldEMailAddr] (with and without table name)
to no avail, but it feels close!!

Additionally, I would like to be able to use another command button to open
the clients Web Page >fldWebAddr< also from >tblMainWorkInProgress<, and I'm
betting that the solution is similar!

I'm just starting to use VBA code (i.e. I've become an "expert" in cutting
and pasting code to the proper location <[ ; - ) - note the dunce cap!

Thanks again for your help.

Bob Loder
Tampa, FL

P.S. At the suggestion of these newsgroup members, I have purchased "Access
2000 Developers Handbook" and several others that were suggested. Somewhat
over my head at this point, but I'm hellbent on becoming the best "Access
Hobbiest" around! Not easy at 56 years old, but you'll see - I'll be
answering questions (giving back) in no time!
 
Thanks, Cheryl,

Guess I wasn't as close as I thought I was!

You're right. My first attempt was making field hyperlink opened OE when I
clicked on field!!! New instantly - that was not a good thing - lol.

Couldn't I create a command button (labeled "Send E-Mail to Current
Client"), and use your code OnClick vs >DoubleClick on fieldbox<?

Thanks again. I always read your answers to others' questions - your
approach is always very practical. <--- That's a good thing!

Bob Loder
Tampa, FL
 
In the Click (or DoubleClick) event for the email control try using
docmd.SendObject:

DoCmd.SendObject , , , Me.fldEMailAddr, , , "Your Subject", "Optional
BoilerPlate Text", True

The subject and Message parameters are optional, you can take them out. The
Editmessage parameter tells SendObject to keep the message open for editing.
For more help on the parameters look in the Online help (fastest route: from
the vb editor, type in SendObject the hit F1).

Make sure that fldEmailAddr is the name of the control on the form.

To open the hyperlink, you can use the FollowHyperlink method:

FollowHyperlink Me.fldWebAddr

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

Bob said:
Hi, Braintrust!

You folks have helped me tremendously over the last couple of months, and
I hope you can help me one more time!

I have a relatively simple Db for use within my own company only (Win XP
Pro, Access 2k, 10 user lan).

I would "simply" like to offer the user the ability (from a command
button?) to open Outlook Express with the current records e-mail address
filled in, (the user can then complete and send there e-mail to the
current record).

The e-mail address is captured in the field >fldEMailAddr< from
tblMainWorkInProgress<.
I've tried an "OnClick" event
=mailto:[tblMainWorkInProgress].[fldEMailAddr] (with and without table
name) to no avail, but it feels close!!

Additionally, I would like to be able to use another command button to
open the clients Web Page >fldWebAddr< also from >tblMainWorkInProgress<,
and I'm betting that the solution is similar!

I'm just starting to use VBA code (i.e. I've become an "expert" in cutting
and pasting code to the proper location <[ ; - ) - note the dunce cap!

Thanks again for your help.

Bob Loder
Tampa, FL

P.S. At the suggestion of these newsgroup members, I have purchased
"Access 2000 Developers Handbook" and several others that were suggested.
Somewhat over my head at this point, but I'm hellbent on becoming the
best "Access Hobbiest" around! Not easy at 56 years old, but you'll see
- I'll be answering questions (giving back) in no time!
 
Couldn't I create a command button (labeled "Send E-Mail to Current
Client"), and use your code OnClick vs >DoubleClick on fieldbox<?

I don't see why not. Give it a go.
Thanks again. I always read your answers to others' questions - your
approach is always very practical. <--- That's a good thing!

You're welcome and thanks for your nice comment.
 
Back
Top