Email Address in Table

G

Guest

Apologies for the duplicate post but I think something may be wrong with my
original post as Rick B responded to my post as follows: "OK. Do you have a
question".

So I am trying again. Here is my question:

I want a field in a table for email address. I do not want the user to have
to type mailto: I do not know how to format a field for this.

Thank you professionals...happy holidays.
 
J

Jeff Conrad

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:
(e-mail address removed)
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.
 
G

Guest

Jeff,

Thanks SO much. This worked perfectly and it was way beyond what I was
trying to accomplish yet a really refreshing means of accomplishing what we
wanted to. Happy holidays!
 
J

John Nurick

As Rick pointed out, you made some statements but didn't actually ask a
question.

And in this message you've done it again.

Possibly the answer to the question you haven't asked is

"You can't do this by formatting a field. Store the email address in an
ordinary text field. On a form, add a text box bound to the field. Name
the textbox txtXXX, where XXX is the name of the field. In the text
box's Click event procedure, put something like this:
Application.FollowHyperlink "mailto:" & Me.ActiveControl.Value
.."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top