Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Create a hyperlink in a string value

4 views
Skip to first unread message

Eka1618

unread,
Apr 16, 2008, 9:06:00 AM4/16/08
to
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

unread,
Apr 16, 2008, 3:13:29 PM4/16/08
to
"Eka1618" <Eka...@discussions.microsoft.com> wrote in message
news:FABD0701-E335-400B...@microsoft.com...

> 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...

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.

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


Eka1618

unread,
Apr 16, 2008, 3:31:00 PM4/16/08
to
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~

Michael Cole

unread,
Apr 17, 2008, 12:15:27 AM4/17/08
to
Eka1618 wrote:
> 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.

--
Regards,

Michael Cole


Dmitriy Antonov

unread,
Apr 17, 2008, 1:48:53 AM4/17/08
to

"Eka1618" <Eka...@discussions.microsoft.com> wrote in message
news:FABD0701-E335-400B...@microsoft.com...
> 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...
>
--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

unread,
Aug 14, 2008, 8:11:01 PM8/14/08
to
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.
0 new messages