Create Link That opens an Access Database from an e-mail.

E

Eka1618

Hello,

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.

here is the VB code 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top