Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email hyperlinks 2

Status
Not open for further replies.

aaronjonmartin

Technical User
Jul 9, 2002
475
GB
I was wondering, i have a field in which i store a contacts email address. Is there anyway i can set this as a hyperlink that when clicked launches as an email in Outlook with the contacts email address in the To field. This is how it works in html with the mailto: command, i want to mirror this in accesss. Any help with this is much appreciated.

Aaron

"It's so much easier to suggest solutions when you don't know too much about the problem."
Malcolm Forbes (1919 - 1990)
 
Not sure about the hyperlink, but I got round it by adding a small button (height of the field entry box) with a pic of an envelope on it, and set that to e-mail to the person in the name field when it's clicked. I guess you could set it on a double click of the name field as well.

The code used is:

If cbxName <> &quot;&quot; Then 'if name exists, send mail

Dim strBody As String
Dim olApp As Object
Set olApp = CreateObject(&quot;Outlook.Application&quot;)
strBody = &quot;&quot;
If MsgBox(&quot;Do you wish to include the Notes field in the e-mail?&quot;, vbYesNo + vbQuestion, &quot;Include Notes&quot;) = vbYes Then
strBody = strBody & Chr(13) & &quot;Notes from IT Cirs database:&quot; & Chr(13) & memnotes
End If

Set olMail = olApp.CreateItem(olMailItem)
olMail.To = cbxName
olMail.Subject = &quot;Cirs Number - &quot; & txtcirsno & &quot;, &quot; & txtdescription
olMail.Body = strBody
olMail.Display
End If ' end send mail
 
Griff, I appreciate the post mate, however im new to this so im not to sure how to apply it to may set up. Where does the code get the email address from? Could you give me a brief description of what exactly the code does?

Thankyou

Aaron

&quot;It's so much easier to suggest solutions when you don't know too much about the problem.&quot;
Malcolm Forbes (1919 - 1990)
 
Right, a very easy way to do this...

Set a field on your table as follows:

Field Name = Email_Address
Data Type = Test
Description = Email Address



In a Form Design View
---------------------
[ol]
[li]On a form insert a text box linking to the field Email_Address and have it visible[/li]
[li]Press F4 TO open the properties menu[/li]
[li]Select the OTHER tab[/li]
[li]In the NAME item, type: Address_Testbox[/li]
[li]Press F4 to remove the properties menu[/li]
[li]Click on insert then on Hyperlink[/li]
[li]When the box pops up, click on Email Address on the right and press the space bar once in the address field.[/li]
[li]Press OK[/li]
[li]You will now have a label with blue underlines text mailto: [/li]
[li]Make the label longer, to accomodate long email addresses[/li]
[li]Set it's NAME to Address_Link (see (2) above on how to do this)[/li]
[li]press F4 to open the properties menu[/li]
[li]from the drop down menu, select FORM[/li]
[li]click on the Event Tab[/li]
[li]click in the On Current item and to the right, you will see ... - Click on it[/li]
[li]Select Code Builder[/li]
[li]type the following between Private Sub Form_Current() and End Sub:[/li]
[/ol]

Code:
If Me.Address_Textbox.Value = &quot;&quot; Or IsNull(Me.Address_Textbox.Value) = True Then
    Me.Address_Link.Caption = &quot;&quot;
    Me.Address_Link.HyperlinkAddress = &quot;&quot;
Else
    Me.Address_Link.HyperlinkAddress = &quot;mailto:&quot; & Me.Address_Textbox.Value
    Me.Address_Link.Caption = Me.Address_Textbox.Value
End If

Now, when you view the form in form view, you will have the text box so you can alter the email address and a link so you can send an email to the email address.

If you don't want the email address to be visible in the text box, change to design view, press F4, Select Address_Textbox from the drop down menu and on the Format tab, set Visible to NO

Hope this helps :)



Aubs
 
Aubs010

Thanks for your post it was very useful. Thankyou

Aaron

&quot;It's so much easier to suggest solutions when you don't know too much about the problem.&quot;
Malcolm Forbes (1919 - 1990)
 
Aaron,

Glad I can be of help!

In fact, I'm glad I saw your post, and then figured out how to do it, because I've just used the same principle to link files on my network into my database!

So thank you too!!



Aubs
 
Hi Folks,

I have a similar problem. I wrote a corrective action database to comply with our ISO procedures. If a corrective action is entered in the form, I would like it a note to be sent to the ISO coordinator notifing her that a new item has been added. I tried the SendObject as a macro, but we are using Lotus Notes and the Macro failed.

What can I do to make it work?

I wanted to use the macro so I can use a command button to send the notification.

Thanks

SuePee
 
If your default mail client is Lotus Notes, and say, when you click an email link on a website, then I can't see why you can't just use the default mail command in access, which should open a new mail in your default client...?

Other than that, I think probably the best solution, as I don't think I can help, is to post a new thread, with the subject of what you need help with in the subject, so you reach a broader range of people.

Sorry I can't help further.

Aubs.

P.S. It's also better, when you ask for help, that you put yourself in the &quot;Who's Marked This Thread?&quot; list... otherwise it could waste peoples time in replying and you may not realise it!

Aubs
 
Thank you very much Aubs010 for this thread!!

I was so upset for I could not make the e-mail thing work.

Thank you again.

Pau75
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top