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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

E-mail hyperlink field

Status
Not open for further replies.

greenter

MIS
Nov 3, 2001
11
US
How do I automatically insert the "mailto:" text in front of the e-mail address so that it doesn't have to be typed every time?
 
if your control is called text2 for example:

Private Sub Text2_AfterUpdate()

Text2 = "mailto:" & Text2

End Sub
 
Did that. When I click on the field, it opens the browser instead of the Outlook message box.
 
That probably means that your browser is set to use itself for email as a default instead of Outlook. If you're using IE, go to Tools, Internet Options, Programs and under E-Mail choose Microsoft Outlook.
 
Greenter,
If you want to send and email then you could use VBA in the event procedure for the text box where the email address is stored.

You need to incorporate something like this:
-----------------------------------------------------------
Private Sub txtYourTextBoxName_Click()
On Error GoTo Err_txtYourTextBoxName_Click

Dim stEmailAddress as String

stEmailAddress = txtYourEmailAddressName.text
DoCmd.SendObject acSendNoObject, , , stEmailAddress, , , "Subject goes here", "Body of email goes here", True



Exit_txtYourTextBoxName_Click:
Exit Sub

Err_txtYourTextBoxName_Click:
MsgBox Err.Description
Resume txtYourTextBoxName_Click

End Sub
-----------------------------------------------------------

This will take the value of 'txtYourTextBoxName' and send and email to that person using the users email program. FYI:You should set the textbox format in the table back to TEXT and format it to look like a hyperlink (blue underlined)in the form. The only drawback that I have found is that it doesn't display the 'hand pointer' that users are accustom to.

The send object does much more than send email. That is why there are so many commas. If you want to see the syntax for the command type [tt]DoCmd.SendObject[/tt]
Highlight the 'SendObject' part and press F1. This will also display some example information and all of the other neat things this does


Keeping track of all the blasted things that can be done is 99% of the battle!
Is this enough information?

JerseyBoy
Remember: self-praise is no recommendation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top