Email

S

Stephen

I have a data field that I enter individuals email address into, I am trying
to create a hyperlink to outlook to create an email when I click on the mail
address. I can create the hyperlink, but it goes to a default blank explorer
page instead of opening a new outlook email document. Any ideas on how I can
make this operation happen?
 
K

Ken

I did a bunch of research on this a while back and I have it working with the
following code:
******************************************
Declare Sub ShellExecute Lib "shell32" Alias "ShellExecuteA" (ByVal AWnd As
Long, _
ByVal AOperation As String, _
ByVal AFileName As String, _
ByVal AParameter As String, _
ByVal ADirectory As String, _
AShowCmd As Long)
*****************************************
Public Function SendEmail(AEmail As String _
) As Boolean

On Local Error GoTo LocalError

DoCmd.Hourglass True
ShellExecute Application.hWndAccessApp, _
"open", _
"mailto:" & AEmail & "?subject=Do It", "", "", 0
DoCmd.Hourglass False
SendEmail = True


LocalError:
DoCmd.Hourglass False
SendEmail = False

End Function
****************************************************
In my form I use the doubleclick event on the email address to call the Send
Email Function
***************************************************
Private Sub Email_DblClick(Cancel As Integer)
SendEmail (Me!EMail)
End Sub
*************************************
you will notice in the code that it puts "Do it" In the subject, you can
use a variable to enter anything you want.

I don't see why you couldn't just copy and paste this code to work for you.
 
S

Stephen

Thanks Ken,

I tried that and still get nothing, I have the function of the field set as
a hyperlink. I added the code you gave me. When I go back to try to get it
to be functional I can see the email as a hyperlink, but when I click on it I
get nothing. I am not sure I am adding the code into the correct field, I do
know I am tired of reading
Access 2003 Inside and out.
 
S

Stephen

I have now been able to make it open the hyperlink, but instead of opening a
mail document it is still opening a blank internet explorer page, giving me a
failed execution notice.
 
K

Ken

Its not a hyperlink, The field is just text to store the email address.
Store the code in a module, except for the double click action goes in the
textbox's double click event.
The shellexecute starts a new email in windows default email handler with
the email address stored in the forms text box.
 
S

Stephen

I put the code under the "on doubleclick" as an expression. If I don't check
that the format is a hyperlink, in form view I see something like this as
example (e-mail address removed)//http:[email protected] and it does not allow me to
do anything with it. If I click that it is a hyperlink I see the email
address as entererd and underlined, when I double click on it I open up a
blank internet explorer page. Is there something I am not understanding or
possibly placing the code in the wrong area?
 
S

Stephen

I don't know what I am doing wrong, I still get the same thing. I am not
sure what you are referring to when you say make sure it is stored as text in
the table.

We us access as a candidate tracking database, the field I am trying to get
this function to work on is the second page of the individuals record.
Before trying to add this funtion to the field it was always just a field in
which you just typed the email address in and move to the next field. I go
into to design view, right click on the databox, goto properties when I added
the code you provide under the doubleclick option.

This doesn't seem like it should be as difficult as this is turning out.
What am I failing to do?
 
K

Ken

It sounds like you are doing everything to the form, but the form stores its
data in a table somewhere. You have to go into that table in design mode and
change the email field from hyperlink to text.
If you don't have access to the table for some reason, you can't do any
more.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top