Avatar of SteveL13
SteveL13
Flag for United States of America asked on

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?
Email ServersMicrosoft Access

Avatar of undefined
Last Comment
SteveL13

8/22/2022 - Mon
Paul MacDonald

You can't force Outlook to open, but a mailto: tag will open the user's default mail application if one is set up.
SteveL13

ASKER
Outlook will be open already.  What is the onclick code to make Outlook have the email address in the To: field
Paul MacDonald

It's in the link I posted.

mailto:someone@example.com?Subject=Hello%20again
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
PatHartman

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.
SteveL13

ASKER
I'll use double-click but I don't know how to code it.
ASKER CERTIFIED SOLUTION
PatHartman

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SteveL13

ASKER
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
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
PatHartman

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.
SteveL13

ASKER
I found the mistake in the table field value.  Once I fixed it all is fine.  Thanks.