Click hyperlink field on a form and have it open an Outlook email window to that email address

On a form I have a field that is an email field.  I have it set as hyperlink on the form.

When the user clicks the hyperlink I want it to open an Outlook email window to that email address.

What is the onclick code to do that?
SteveL13Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Paul MacDonaldDirector, Information SystemsCommented:
You can't force Outlook to open, but a mailto: tag will open the user's default mail application if one is set up.
SteveL13Author Commented:
Outlook will be open already.  What is the onclick code to make Outlook have the email address in the To: field
Paul MacDonaldDirector, Information SystemsCommented:
It's in the link I posted.

mailto:someone@example.com?Subject=Hello%20again
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

PatHartmanCommented:
Do not use the hyperlink data type.  Change it to a standard text field.  In the click event (or preferably the double-click event) use the FollowHyperLink method.  This command recognizes any valid file extension, url, or email address and opens the appropriate application.

On the form, the Hyperlink property simply specifies how the control will be displayed.  It doesn't do anything else.  You must add your own code to open the document.

I suggested the double-click event because even though you want it to act like a hyperlink, if you use the single click, you won't be able to actually edit the value easily because trying to click into the control will cause the hyperlink to be activated.  If you can train your users to always use the tab key to move from control to control, you would be able to get focus into the control and start typing but you still could never click into the center to change a couple of characters.
SteveL13Author Commented:
I'll use double-click but I don't know how to code it.
PatHartmanCommented:
Application.FollowHyperlink Me.YourField, , True

Open in new window


Me.YourField is whatever form field contains the link you want to follow.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SteveL13Author Commented:
Doesn't want to work.  I do not have the field set as a hyperlink but when I double-click the email address I get:

Security Warning
And then when I click "Yes" I get:

After Click Yes
PatHartmanCommented:
The value is incorrect.  It needs to be either what is to the left of the # or what is to the right.  The security message is caused by your macro settings.
SteveL13Author Commented:
I found the mistake in the table field value.  Once I fixed it all is fine.  Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.