By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

making the entries in e-mail field a hyperlink to send an e-mail in outlook

emandel
P: 65
I have searched the forum and the help and am still very confused.

I have a simple table with one of the fields e-mail.
I have a simle form for that table.

Where the contact's e-mail comes up, (either in the form or the table) I would like Access to show me a hyperlink that when I click on it, it opens a new message to that e-mail address. Similar to when you have a hyperlinked e-mail address in MSWord and most other office programs.

Even nicer would be to add a button on the form saying "send e-mail to this person"

Please can you help with this.
Thank you
Jan 5 '07 #1
Share this Question
Share on Google+
17 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
I have searched the forum and the help and am still very confused.

I have a simple table with one of the fields e-mail.
I have a simle form for that table.

Where the contact's e-mail comes up, (either in the form or the table) I would like Access to show me a hyperlink that when I click on it, it opens a new message to that e-mail address. Similar to when you have a hyperlinked e-mail address in MSWord and most other office programs.
In the table with the email field set the fields data type to hyperlink.

Mary
Jan 5 '07 #2

emandel
P: 65
In the table with the email field set the fields data type to hyperlink.

Mary
I tried that, but that opens up the "e-mail address" in Internet explorer, thinking that is a web address!. i.e. if I type a web address it works, but it doesn't work in the sense that an e-mail address gets forwarded to a e-mail program!
Jan 5 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
I tried that, but that opens up the "e-mail address" in Internet explorer, thinking that is a web address!. i.e. if I type a web address it works, but it doesn't work in the sense that an e-mail address gets forwarded to a e-mail program!
Change the field back to text temporarily. Then run find and relplace and replace all http:// with mailto:

Then change back to hyperlink again.

When adding new email addresses add them with mailto: at the start of each address

Mary
Jan 5 '07 #4

emandel
P: 65
Thank you, that worked

Is there any way for access to add the Mailto: without the operator adding it every entry? Other than having that the default text and adding next to it?
Jan 5 '07 #5

MMcCarthy
Expert Mod 10K+
P: 14,534
Thank you, that worked

Is there any way for access to add the Mailto: without the operator adding it every entry? Other than having that the default text and adding next to it?
Probably the easiest way is to hide the actual email control and create an unbound textbox for the user to enter the email address. Then in the after update event of this textbox make the email control equal to correct string.


Expand|Select|Wrap|Line Numbers
  1. Me.email = "mailto:" & Me.NewTextbox
Mary
Jan 5 '07 #6

emandel
P: 65
Ok that works in the sense that on the form I now see hyperlink that says mailto:[person's e-maill asddress]

however it does not allow me to click on the hyperlink.

Do I need to put something in the code f under "click" under "event"?
Jan 5 '07 #7

NeoPa
Expert Mod 15k+
P: 31,615
Instead of hiding the e-mail control, try simply locking it so the operator can click on it after the value has been updated by the code.
Jan 6 '07 #8

MMcCarthy
Expert Mod 10K+
P: 14,534
Ok that works in the sense that on the form I now see hyperlink that says mailto:[person's e-maill asddress]

however it does not allow me to click on the hyperlink.

Do I need to put something in the code f under "click" under "event"?
Go to the properties of the new textbox and at the end of the format properties there should be a hyperlink property.
Jan 6 '07 #9

NeoPa
Expert Mod 15k+
P: 31,615
Oops.
Clearly this is a better solution than mine so please ignore my earlier post.
Jan 6 '07 #10

emandel
P: 65
Sorry, it still isn't working properly.
What I have now is a field where the operator puts in just the e-mail address, this is the field that goes into the table.

A second text box has
Expand|Select|Wrap|Line Numbers
  1. ="mailto:" & [e-mail]
in the control source and the properties is set as a hyperlink.

On the form, the second text box shows as a hyperlink (blue underline etc) it says mailto: and the email address. i.e. it looks like it should work, but nothing happens when you click on it.

Suggestions?
Jan 7 '07 #11

nico5038
Expert 2.5K+
P: 3,072
Don't use a textbox, but insert a Hyperlink (Insert/Hyperlink menu).
Then use:
Me.MailLink.HyperlinkAddress = "mailto:" & Me.EmailField

Nic;o)
Jan 7 '07 #12

pks00
Expert 100+
P: 280
What if u created the txtbox, even if its bounded, does not matter, u can make the forecolor blue and underline, u can use the mouseover event to make a pointy arrow

then use the click event to open it up, somethng simple like DoCmd.SendObject

eg
private sub myemailfield_Click()
On Error Resume Next
DoCmd.SendObject , , acFormatTXT, me.myemailfield, , , , , True
'If error occurred and user has not cancelled
If Err.Number <> 0 And Err.Number <> 2501 Then
MsgBox "An error has occurred. " & Err.Description
End If
end sub
Jan 7 '07 #13

emandel
P: 65
Nico,

your suggestion makes sense to me, but I still can't get it to work.
When I insert the hyper link it asks me to choose what the address is. Is it an e-mail address? web page etc.
It would mke sense to choose e-mail. but when I do that and than type
Expand|Select|Wrap|Line Numbers
  1. ="mailto:" & doners.[e-mail]
The outlook new e-mail message opens (which is good) but tin the to: field of the new message it shows "doners.[e-mail] (which is not good)
:(
Jan 7 '07 #14

NeoPa
Expert Mod 15k+
P: 31,615
You have
Expand|Select|Wrap|Line Numbers
  1. ="mailto:" & doners.[e-mail]
but Nico suggested
Expand|Select|Wrap|Line Numbers
  1. Me.MailLink.HyperlinkAddress = "mailto:" & Me.EmailField
Is there any reason why you didn't use Nico's suggestion?
I would expect that to work.
It seems to be different in two ways :
1. Uses Me. rather than doners.
2. Sets .HyperlinkAddress explicitly (unsure what yours is setting).
If it doesn't work, one thing I've found in the past (within Outlook actually but maybe worth looking at here if all else fails) is that "smtp:" sometimes works when "mailto:" doesn't.
Jan 7 '07 #15

P: 1
The simplest way I have done this is to attach a "Person" Smart tag to the Email field, the user then only needs to choose "email" from the smart tag options... you can use a simple text field (I usually use a blue underlined text, it is what people are used to seeing to identify email addresses. the smart tag does all the work for you.

Is there any better benefit/reason for doing it through all that Mailto: code?

Just curious.

PM
Jan 30 '07 #16

MMcCarthy
Expert Mod 10K+
P: 14,534
The simplest way I have done this is to attach a "Person" Smart tag to the Email field, the user then only needs to choose "email" from the smart tag options... you can use a simple text field (I usually use a blue underlined text, it is what people are used to seeing to identify email addresses. the smart tag does all the work for you.

Is there any better benefit/reason for doing it through all that Mailto: code?

Just curious.

PM
It depends what version of Access the OP is using.
Jan 30 '07 #17

P: 2
I'd made some modifications to original code and after that i did adapt it to my form, this code is for a buton located beside the field that has the email adddres of my contact in the form, Note: this field has to be declared as TEXT not as hiperlink.
The code is this

Expand|Select|Wrap|Line Numbers
  1. Private Sub Send_email_Pers__Click()
  2. On Error GoTo Err_Send_email_Pers__Click
  3. Dim To_ As String
  4. Dim Cc_ As String
  5.  
  6.  
  7. email_pers_.SetFocus
  8. To_ = email_pers_.Text
  9. email_Off_.SetFocus
  10. Cc_ = email_Off_.Text
  11. email_pers_.SetFocus
  12.  
  13. DoCmd.SendObject , , , To_, Cc_, , , , , intSeeOutlook
  14.  
  15. x = MsgBox("Email has been sent")
  16.  
  17. Exit_Send_email_Pers__Click:
  18.     Exit Sub
  19.  
  20. Err_Send_email_Pers__Click:
  21.     MsgBox Err.Description
  22.     Resume Exit_Send_email_Pers__Click
  23.  
  24.  
  25. End Sub
Any question please don't hesitate to ask
best regards
Jose Luis
Feb 14 '07 #18

Post your reply

Sign in to post your reply or Sign up for a free account.