Opening email client (Outlook) from Form

G

Graham

Having searched the forums for information on this, there is much
contradictory advice. I have a Field (Personal email) in a Table, and on an
associated Form. This field has an email address, and/or can be updated with
an email address. If I enter a new email address, I want it to be formatted
so as to launch my email client when I double click it.
Some advice says to format it as a hyperlink field, which adds "http:// "in
front of the email address, which is obviously not going to work. If I edit
this and add "MailTo" then it will work, but each entry has to be manually
edited, as do any new additions.
Should I format as a hyperlink, or leave as a text box ?
If I set the property for the Double Click,
"FollowHyperlink(MailTo:&Personal email)" This doesn't appear to work ?
Could some one please clarify what I should do, and/or tell me what's wrong
with the above property so it will work ?
Many Thanks
 
E

Ed Robichaud

My previous reply to you bounced back, but the short answer is to use a text
field to store an email address, and the SendObject command to invoke your
default email program to send to it.

An example:
=================================
Private Sub email_Click()
Dim strEmail As String
Dim strMailSubject As String
Dim strMsg As String

If IsNull([txtEmail]) Then
MsgBox " No address found ! ", vbExclamation, "Missing e-mail"
Else
On Error Resume Next
strEmail = Me!
strMailSubject = ""

DoCmd.SendObject , , , To:=strEmail, subject:=strMailSubject,
MessageText:=strMsg
End If

If Err.Number = 2501 Then
MsgBox " Email message cancelled ", vbExclamation
End If

Exit_Email_Click:
Exit Sub

Err_Email_Click:
' MsgBox " Email message cancelled ", vbExclamation
MsgBox Error$
Resume Exit_Email_Click

End Sub

===========================
 

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