View Single Post
  #8  
Old October 4th, 2007, 04:46 PM posted to microsoft.public.access.gettingstarted
MikeP125
external usenet poster
 
Posts: 16
Default replace http:// with mailto:

This code to create an email by double clicking is great! Can code be added
so that not only will it fill in the email address, it will fill in the
subject line and message body based on two separate text fields that I
already have populated?

"Jeff Conrad" wrote:

"tlaker" wrote in message:
...

when entering an e-mail address on my form, Access 2000 changes it so that it
links to a webpage. How can I replace the "http://" with "mailto:" after
update?


Hi,

It sounds like you have the table field defined to be a Hyperlink field.
I would set the field to be a text field, not Hyperlink to avoid this problem.

Here is a past post of mine on this issue which details how to avoid
the problem you are having, as well as how to send the person an e-mail
message by double clicking on that form field.


1. Make a field in the table called EmailAddress set as Text (not hyperlink).

2. Enter the e-mail addresses like so on the data entry form:

They will not have to type the "mailto" part

3. Code the double-click event of that field's control on the data entry form like so:

Private Sub EmailAddress_DblClick(Cancel As Integer)
On Error GoTo ErrorPoint

Dim strEmail As String

' Stop the Web Toolbar from appearing
DoCmd.ShowToolbar "Web", acToolbarNo

If Not IsNull(Me.EmailAddress) Then
strEmail = Me.EmailAddress
If Left(strEmail, 7) "mailto:" Then
strEmail = "mailto: " & strEmail
End If
Application.FollowHyperlink strEmail
End If

ExitPoint:
Exit Sub

ErrorPoint:
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " _
& Err.Description, vbExclamation, _
"Unexpected Error"
Resume ExitPoint

End Sub

Double-clicking on that field will bring up Outlook (assuming that is
what you are using) with a new message and their e-mail address already filled in.


Hope that gets you going,
--
Jeff Conrad
Access Junkie
Bend, Oregon