email link

  • Thread starter Thread starter arthurgrajeda
  • Start date Start date
A

arthurgrajeda

I have a database that containes a field labled email:

Inside the text box next to the label is that persons email account. It
is set to hyperlink. Instead of going to the internet how would I allow
microsoft outlook to open up and send an email out with this address
filled in.


The next step would be to have the subject filled out. "Company Name"

Please help, thanks.:)
 
Arthur,

In order to make the hyperlink value a "mailto" instead of an "http", you
would need to right-click on each field value and then, from the shortcut
menu which appears, select Edit Hyperlink to change it from an internet to
an email hyperlink. I think you would find it much easier to:

1. In your Table's design, change the Field Type from HyperLink to Text.
2. In your Form's design view, open the Properties for the text box that
contains the email address.
3. Insert the following code in an event procedure for the Dbl Click event
of the textbox

Dim strEmail as String

strEmail = "mailto:" & Me.MyEmailField
Application.FollowHyperlink Address:=strEmail

4. You can format the textbox to make it a different color from black and
underlined, so that it looks like a hyperlink. When a user double-clicks
with the mouse on this text box on your form, it will open your default
email program with the email address inserted in the To: area.

If you want to get additional information in the email such as "Subject", I
believe you will have to do a bit more coding and use Outlook Automation.

Post back if you have any additional questions.
 
Private Sub Email_Address_DblClick(Cancel As Integer)

Dim strEmail as String

strEmail = "mailto:" & Me.MyEmailField
Application.FollowHyperlink Address:=strEmail

End Sub


This is how I entered it it the dbl click event procedure. th
Me.MyEmailField, should I change this to say "Email Address" becaus
that is the name I called my field
 
Also, since I noticed that there is a space in your field name, Email
Address, your field name should have brackets around it:

strEmail = "mailto:" & Me.[Email Address]
 
Cheryl offered some good ideas for using TEXT and DBL CLICK... however to add the message , subject etc you might try the following

DoCmd.SendObject acSendNoObject, , acFormatTXT, Me!EMailField, , , , "Text for content", ", Tru

I used this solution last night for the exact same purpose you have

There are other options you can find using SendObject in the VBA Assistant..

Good Luck..
 
Private Sub Email_Address_DblClick(Cancel As Integer)

Dim strEmail As String

strEmail = "mailto:" & Me.[Email Address]
Application.FollowHyperlink Address:=strEmail


End Sub

I am starting to wonder if I am doing this totally wrong. Above is ho
I entered it into the code view.

I right click on the field name and choose dbl click event procedur
then I click on the ... button and it takes me to the code view. I the
save the changes and it still takes me to a web address. I am sorr
guys about asking the same question over and over I just really need t
learn this. Thanks for your patience and understanding. Please let m
know what I can be doing wrong
 
No problem, Arthur.

In your initial post, you indicated that the Data Type of the field
containing your email addresses was HyperLink. In one of my replies to
you, I said that to use the two lines of code I supplied you would need to
change the field's Data Type (in table design) to Text. So, is it possible
that the DataType of the field as it is set up in your table is still
HyperLink?

You should be aware also that once a field is changed from Hyperlink to
Text, all of the stored information about the Hyperlink is retained.

For example, when your field was a HyperLink data type, you would see the
following in your table or form:

(e-mail address removed)

In reality, the following is what gets stored in the Hyperlink field:

[email protected]#http://[email protected]

After you convert a Hyperlink field to a Text field in your table's design,
all of the stored information, including the URL is converted to text, so
your Text Field's contents would look like just like the above, except that
it is plain text.

If you have already converted your field's DataType to Text, you can do an
update query to strip the # sign and everything after it from the field, or
manually edit the field.

Does that help? Post back if you need further clarification.
 
Ok I checked the table and verified that field was a text field. Only
have few lines of data, this a database that is not is use yet so
erased all the info.

I then entered in a new email address in the field. (e-mail address removed) an
it still brought up a web page.

I checked the table in which the data is stored and it appeared lik
this.

[email protected]#http://[email protected]
 
Arthur,

I must admit that I am stumped by the behavior you report from the database.
Using Access 2002, I have been testing out the different behaviors of
Hyperlink and Text type fields and have been changing the Field Types back
and forth a lot. I have seen no instance of the former Hyperlink field
retaining the #http:// ... mask after it is edited.

What version of Access are you using? This may or may not be significant.
I'll try to see what the MS KB has to say on the subject; we could also try
a Google groups search.
 
Arthur,

I have not found anything in the MS KB or Google that seems to address the
issue. Since your database is not in use yet and you have erased the data
in your EMail field, how about trying this:

1. In the Design View of your table, delete the field EMail
2. Save and close the table.
3. Close the database and do a compact/repair
4. Open the database and then the table and add a field, EMail, to the
table. Leave its default data type as Text.

Let me know if that works.
 
Ok here are my step by step actions.

I went in my table and removed the Email Adress field.
Deleted it.
Saved.
Did a compact and repair.
Then I opened the table and added a new field called Email and left i
as a text field.

I then went to the form and deleted the text box and reentered a tex
box. Named it email and connect to the control source email.
Built and event and added the following code.

------------------------------------------------------------------
Private Sub Email_DblClick(Cancel As Integer)

Dim strEmail As String

strEmail = "mailto:" & Me.Email
Application.FollowHyperlink Address:=strEmail

End Sub

-------------------------------------------------------------------
I then added an email address in the form, (e-mail address removed) an
clicked the link and it tried to take me to a website. I checked th
table and the following stored.

[email protected]#http://[email protected]#

The only thing I can think it may be is that this is a page is on on
of 4 subforms.

You have been a great help Cheryl Fischer. I will not give up and wil
keep trying for answer. Let me know if you locate anything else
 
Arthur,

I do not normally do this, but if you want to put your database in a zip
file and email it to me I will be glad to look at it. You can edit my
email address easily so that it works.
 
Arthur,

Sorry. I thought it would appear in my posts. Anyway, it is:

(e-mail address removed)

Remove the NOSPAM
 
Back
Top