• Subject: Create Link in E-mail that opens an Access database
  • Author: Eka1618
  • Date: 14 Apr 2008
  • References:
Hello,

I have read the thread "autofilling access database from outlook" and took
read the link that was posted in the reponse, but I cannot seem to get the
answer I'm looking for.

I have my database set up so that it automatically sends an e-mail to a
person based on form values. I would like to place an embeded link into the
message that will open up the database that sent the e-mail.

If that cannot be done, is there a simple way to add the link manually in
the Outlook message? I just want it to open the database right from the
e-mail so that they do not have to close the message and find the folder that
the database resides in.

I realize that this is an Outlook forum, but here is the VB code in Access
that send the e-mail to outlook:

Dim emailBody As String
Dim emailSubject As String

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
14 Apr 2008Create Link in E-mail that opens an Access database.Eka1618
14 Apr 2008\ Re: Create Link in E-mail that opens an Access database.Ken Slovak - [MVP - O...
All times are in (US) Eastern Daylight Time (GMT -4:00)