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!

Mailto: Hyperlink 5

Status
Not open for further replies.

AyJayEL

Technical User
Jan 30, 2001
425
GB
I have a field called email in my database (Access 2000). Can I make it automatically convert to a hyperlink that will open the users outlook with the correct address in the To line or the mail when clicked on? Learn something new every day *:->*
 
You can have the text box 'behave' like a mailto: hyperlink.

Sub YourTextBox_Click()
DoCmd.SendObject,,, Me("YourTextBox"),,,,,True
End Sub

YourTextBox is the exact name of the text box on the form.

HTH,

Dan
[pipe]
 
Dear Dan

You'll have to help a thicky a bit more. This is what I did. I clicked on the text box that holds my email address (called E_mail). Opened the properties and gone into event procedure. I then put this in the box.

Sub E-mail_Click()
DoCmd.SendObject,,, Me(E_mail),,,,,True
End Sub

When I then click on the text box in the form I get this message. Runtime error 2465
Microsoft Access can't find the field 'jdoe@hotmail.com# referred to in your expression.

I am obviously doing something wrong (understatement of the year?) Learn something new every day *:->*
 
Ha! Not such a thicko! I have got it working in this way.

In the afterupdate event put this (where [E-mail] equals the name of your field.

Me![E-mail] = "#mailto:" & Left(Me![E-mail], InStr(1, Me![E-mail], "#") - 1) & "#"

I wish I could give myself a star! [rofl2] Learn something new every day *:->*
 
I'll give you a star! Nice solution.
Another way would be:

DoCmd.SendObject,,, "#mailto:" & Left(Me![E-mail], InStr(1, Me![E-mail], "#") - 1) & "#"
,,,,,True

and not change the email address.

But if it works, that's all is required.

Ben ----------------------------------------
Ben O'Hara
Home: bpo@SickOfSpam.RobotParade.co.uk
Work: bo104@SickOfSpam.westyorkshire.pnn.police.uk
(in case you've not worked it out get rid of Sick Of Spam to mail me!)
Web: ----------------------------------------
 
Andy: You forgot the double quotes...the correct syntax would be:

DoCmd.SendObject,,, Me("E_mail"),,,,,True

You can also lose the Me keyword and you'll have:

DoCmd.SendObject,,, E_mail,,,,,True

which also works.

You're getting the error message because Me(E_Mail) tries to find the control having the name of whatever is displayed in the control E_mail.
VB notation can be puzzling sometimes...

Regards,

Dan
[pipe]
 
I have given you both a star because I can really see the potential of the docommand sendobject thingy!

I have another database I will need to create that sends reminders to people. Great!

Thank you so much, my tek-tip heros! Learn something new every day *:->*
 
Dear Dan

I have just had a chance to do this in the way that you described. Excellent. I have got it automatically sending an email including all the details of address of a site and a subject heading and filling in the Dear "Name" with all the fields being pulled straight from the database. It also sends copies to relevant people automatically. I don't know if it will allow me to give you another star but I will try.

Andrea Learn something new every day *:->*
 
Come on, Andrea, you'll soon run out of stars [lol]

Dan
[pipe]
 
Very useful thread I will try it later BUT......

How do you send an email to all the e mail addresses returned by a query. I want to send the message to 1 pre-designated person and the BCC the same message to any number of users.

This is not for Spam mail but an internal variabl list of staff

Neil Berryman
IT Trainer
neil_berryman@btopenworld.com
 
Neil

Create your Query with a field called EMAIL and any other fields you might want to pick up in the document. Now create a Word Mail Merge document (Form Letter) with the message that you want in it linked to the query as the data source. Then click on Merge in the word document and choose Electronic Mail.

This will send to everyone in the query seperately. In other words in the same way as if you had sent it by BCC..

Andrea Learn something new every day *:->*
 
I think this will create a seperate e mail for each e mail address.

I want one message to many people not a seperate copy of the same message to each person (hence BCC)

Hope thats clearer
Neil Berryman
IT Trainer
neil_berryman@btopenworld.com
 
Neil

I knew that was what you wanted but I don't know another solution for you. Sorry, Perhaps someone else does.

Andrea Learn something new every day *:->*
 
No need to apologise Andy, all help is appreciated I thought I explained it badly

Regards Neil Berryman
IT Trainer
neil_berryman@btopenworld.com
 
I know I've posted this before, but I couldn't find it, so I'll post it again:

Function ColumnToLine(TblQueryName, ColumnName)
On Error GoTo ErrInFunction
Dim myRs As DAO.Recordset
Dim ResultString As String
Set myRs = CurrentDb.OpenRecordset(TblQueryName)
If myRs.RecordCount > 0 Then
Do Until myRs.EOF
ColumnToLine = ColumnToLine & IIf(Len(ColumnToLine) = 0, "", "; ") & myRs(ColumnName)
myRs.MoveNext
Loop
End If
FinishPoint:
On Error Resume Next
myRs.Close
Exit Function
ErrInFunction:
ColumnToLine = "Error: " & Err.Description
Resume FinishPoint
Exit Function
End Function

This function gets all values in a column of data and builds a string (values are separated by semicolon).
Just pass the ColumnToLine result to the BCC field.

Good luck [pipe]
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
 
Many thanks, a star without a doubt

Cheers

Neil Berryman
IT Trainer
neil_berryman@btopenworld.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top