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
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
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~
What is your html? It should be <a href="mailto:your_email_address">E-mail
Me!</a>
Note the mailto: bit.
--
Regards,
Michael Cole
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.