Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / VB Syntax / August 2008



Tip: Looking for answers? Try searching our database.

Create a hyperlink in a string value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eka1618 - 16 Apr 2008 14:06 GMT
Hello,

I have an Access Database. In this database, durring several different
ocations an e-mail message will be generate and sent to whoever. What I want
to do is create a string of some sort that will store the location of the
database on the network, and then somehow add this string as a hyperlink to a
predefined e-mail message that generates when the e-mail itself generates. I
am using VB for Access, but no one in those forums seem to know how to create
a link I guess...

Here is the code that already generate the e-mail:

Private Sub btnSend_Click()

Dim emName, emName2  As String, varItem As Variant
Dim emailBody As String
Dim emailSubject As String

'Dim db As String
'db = "<a href = ""G:\Shared Files\Eng_Favs\Test
Database_4_14_08.accdb"">Test Database</a>"

emailSubject = "Product Test Request"

On Error GoTo btnSend_Click_error
If Me!lboRequestor.ItemsSelected.Count = 0 Then
MsgBox "Please select a test requestor"
Exit Sub
End If
Me.PART_NO.SetFocus
emailBody = "Hello, " & vbCrLf & vbCrLf & _
"A product test request has been issued for the following Part Number: " &
Me.PART_NO.Text & _
vbCrLf & vbCrLf & "Please log into the Product Engineering test database to
review this request, Thank You!"

On Error GoTo btnSend_Click_error
If Me!lboRequestee.ItemsSelected.Count = 0 Then
MsgBox "Please select a test requestee"
Exit Sub
End If

For Each varItem In Me!lboRequestee.ItemsSelected
emName = emName & Chr(34) & Me!lboRequestee.Column(2, varItem) & Chr(34) & ","
Next varItem

For Each varItem In Me!lboRequestor.ItemsSelected
emName2 = emName2 & Chr(34) & Me!lboRequestor.Column(2, varItem) & Chr(34) &
","
Next varItem

'remove the extra comma at the end
'add the requestor to the e-mail list recipients
emName2 = Left$(emName2, Len(emName2) - 1)
emName = emName & emName2

'send message
DoCmd.SendObject acSendNoObject, , , emName, , , emailSubject, emailBody,
True, False

DoCmd.Close acForm, "frmRequest", acSaveNo
DoCmd.OpenForm "frmMain", acNormal, , , , acDialog

btnSend_Click_error:
If Err.Number = 2501 Then
MsgBox "You just canceled the e-mail", vbCritical, "Alert"
End If

End Sub
Ken Halter - 16 Apr 2008 20:13 GMT
> Hello,
>
[quoted text clipped - 9 lines]
> create
> a link I guess...

Wouldn't that link be hard-coded into that 'predefined e-mail message'?

Producing html that shows as a link in some viewer that supports hyperlink
techonolgy isn't very hard. Just open any web page and select "View
Source"... there should be plenty of text in there that, when viewed thru
IE, show as links.

If it has to be dynamic and support "on the fly" changes, you can "bookmark"
a section of that email using pipe characters, or similar... and when the
time comes to merge that 'predefined e-mail message' with your output, a
simple search/replace should do the trick.

If this is way off, I guess I'm not grasping how that email is "generated"
in the first place.

Signature

Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm

Eka1618 - 16 Apr 2008 20:31 GMT
Well I was trying to hard code it because I only want them to open up a
particular database. I hoped that if I wrote the html for a link it would
display as a link in Outlook when the e-mail message opens up, but it
displays as : <a href...

The code that I provided sets up different properties of the e-mail, then
with the docmd.sendobject command, it uses the variables to set up and open
an e-mail message that can be edited in Outlook before the message is sent. I
just want the hyperlink to automatically generate along with the rest of the
message that is assigned to the string emailBody.

I can manually put a hyperlink when the e-mail opens, but it would be easier
for the users to have to do this everytime...

~Erica~

> > Hello,
> >
[quoted text clipped - 24 lines]
> If this is way off, I guess I'm not grasping how that email is "generated"
> in the first place.
Michael Cole - 17 Apr 2008 05:15 GMT
> Well I was trying to hard code it because I only want them to open up
> a particular database. I hoped that if I wrote the html for a link it
> would display as a link in Outlook when the e-mail message opens up,
> but it displays as : <a href...

What is your html?  It should be <a href="mailto:your_email_address">E-mail
Me!</a>

Note the mailto: bit.

Signature

Regards,

Michael Cole

Dmitriy Antonov - 17 Apr 2008 06:48 GMT
> Hello,
>
[quoted text clipped - 9 lines]
> create
> a link I guess...

--snip

It seems that you can't do it. Access can format an object into HTML, XML
and other formats and send it as attachment. But the body of the email is
still a plain text. You might need to consider CDO or something like this.

Dmitriy.
Carole D - 15 Aug 2008 01:11 GMT
My quick-and-dirty solution is to put my cursor at the end of the text URL in
the message and press the spacebar. Outlook then converts the text to a link.

> Hello,
>
[quoted text clipped - 65 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.