mailto: in Access Form

  • Thread starter Thread starter J Warren
  • Start date Start date
J

J Warren

Hello,
I currently have an access form that reads a table of email address. I
have set the email field Properties to Hyperlink. When the field is
shown it shows the selected email address as a hyperlink but is does
nothing when clicked on. Is there a way to set the field to open a new
email from my default email program?

Thank you,
J. Warren
 
there is a sendobject macro that sends an email - create a new macro and
scroll down and you can play with it

personally ive never used it so good luck
 
J Warren said:
Hello,
I currently have an access form that reads a table of email address. I
have set the email field Properties to Hyperlink. When the field is
shown it shows the selected email address as a hyperlink but is does
nothing when clicked on. Is there a way to set the field to open a new
email from my default email program?

You have to make sure it's a "mailto:" hyperlink. Unfortunately, Access
seems almost perversely to assume that anything you type in a hyperlink
field is an http: address. If you edit the hyperlink using Insert ->
Hyperlink (and choose to insert an e-mail address), or if you type
"mailto:" before the address, it will be interpreted correctly, and then
it will behave the way you want when you click on it.

If you want to avoid having to type "mailto:" on your form, you can
correct Access's misapprehension with code in the control's AfterUpdate
event, along these lines:

'---- start of example code ----
Private Sub HyperlinkField_AfterUpdate()

Dim strAddress As String

If Len(Me.HyperlinkField & vbNullString) > 0 Then

strAddress = HyperlinkPart(Me.HyperlinkField, acAddress)

If Left(strAddress, 7) = "http://" Then
Me.HyperlinkField = _
HyperlinkPart(Me.HyperlinkField, acDisplayText) & _
"#mailto:" & Mid(strAddress, 8) & "#" & _
HyperlinkPart(Me.HyperlinkField, acSubAddress)
End If

End If

End Sub

'---- end of example code ----

My personal preference is to forgo hyperlink fields entirely, and just
use text fields. Then when I want to "follow" the link, I can use
DoCmd.SendObject or Application.FollowHyperlink:


'---- start of example code #2 ----
Private Sub EmailAddress_DblClick()

Application.FollowHyperlink "mailto:" & Me.EmailAddress

End Sub
'---- end of example code #2 ----
 
J said:
Hello,
I currently have an access form that reads a table of email address. I
have set the email field Properties to Hyperlink. When the field is
shown it shows the selected email address as a hyperlink but is does
nothing when clicked on. Is there a way to set the field to open a new
email from my default email program?

Thank you,
J. Warren

You do not need to use the hyperlink datatype to send an email to the
address. Use a regular Text DataType instead.

Code the Double-click event of the form control that shows the field:

Application.FollowHyperlink "Mailto:" & [ControlName]

Making corrections to the text field is much easier than editing a
hyperlink field.
 
Thank you for all of the help everyone provided. It gave m enough
insight and imagination to try some things out that have worked well.

Thanks again!

J. Warren
 
Back
Top