Log in

View Full Version : Send HTML email with hyperlink to a .mdb file



talytech
03-17-2011, 11:59 AM
Can someone tell me if this is possible? I am trying to send a HTML email from MS Access to outlook. In this email I want to include a hyperlink to a database file (.mdb). I want the end user to be able to click on that link and it opens the database.

Is that possible?

Here is my code where I set up the email:

Public olApplication As Outlook.Application
Public olns As Outlook.Namespace
Public myItem As Outlook.MailItem

Dim theTo, theSub, thecc As String
Set olApplication = CreateObject("Outlook.Application")
Set olns = olApplication.GetNamespace("MAPI")
Set myItem = olApplication.CreateItem(olMailItem)
myItem.HTMLBody = "<HTML><BODY><P><b>Date:</b> " & Date()
"<P><b>Current Weather Conditions</b><br></p>" & _
"<P><a href="C:\Documents and Settings\e3utbl\Desktop\FTPTest\Testings.mdb">Click Here</a></p>

myItem.Subject = theSub
myItem.To = "" & theTo
myItem.SentOnBehalfOfName = "incident_mgt_ctr@talytech.com"
myItem.Send

SoftwareMatt
03-18-2011, 09:09 AM
That should work - what's the problem?

talytech
03-18-2011, 10:41 AM
The problem is the hyperlink doesn't open the database. Once the recipient receives the email and click on the link, it takes them to the folder where the database is stored. I want them to click on the link and open the database.

HiTechCoach
03-18-2011, 10:59 AM
My understanding is that the proper syntax for a URL to a file is to start with file:///

try:
"<P><a href="file:///C:\Documents And Settings\e3utbl\Desktop\FTPTest\Testings.mdb">Click Here</a></p>

talytech
03-21-2011, 07:39 AM
Thanks but I have the hyperlink in my email but the problem is that it doesn't open the database.

HiTechCoach
03-25-2011, 12:27 PM
Did you get this resolved?

talytech
03-28-2011, 08:08 AM
No . I never got it resolved. I'm trying another method which i'm having problems with as well. Basically I have a Word Document that includes a command button "Reviewed". When the end user clicks that button it populates 2 text controls on that document. "ReviewerName" and "Date". Where the reviewer name is the current user and the Date is the current date. Then it appends that data to a table in my database which I connect to thru DAO. All of that works fine. My problem is when I try to send the attachment of the document for review to the next recipient, the next recipients changes arent saved to the original document. How can i get it to save to the original document and not to there local?

HiTechCoach
03-28-2011, 09:07 AM
No . I never got it resolved. I'm trying another method which i'm having problems with as well. Basically I have a Word Document that includes a command button "Reviewed". When the end user clicks that button it populates 2 text controls on that document. "ReviewerName" and "Date". Where the reviewer name is the current user and the Date is the current date. Then it appends that data to a table in my database which I connect to thru DAO. All of that works fine. My problem is when I try to send the attachment of the document for review to the next recipient, the next recipients changes arent saved to the original document. How can i get it to save to the original document and not to there local?

I would not send the Word document as an attachment. I would only send a link to the original word document. This way everyone is opening the same Word document.

SKYLINE
04-07-2011, 06:45 AM
I have been experiencing the same/similar problem and hope this may help:

From G:\Folder1\db1.mdb I sent an email to a user with a link to open a different database - G:\Folder2\db2.mdb. I created both .mdb's in Folder1 and then moved db2.mdb to Folder2. When the user received the email, the path for the link had changed to G:\Folder1\db1.mdb. The Default Database Folder for db2.mdb had G:\Folder1 in it so I changed it to G:\Folder2 but that didn't fix the problem. For an unrelated reason I renamed Folder2. db2.mdb has a form set to open at Startup, and when I tried to open db2 myself after renaming the folder I got an error message that it couldn't find the form, but it referenced G:\Folder1.

So I changed the folder name back and opened G:\Folder2\db2.mdb, then created a new form and set the new form to open at startup. When I emailed the link to the user it correctly opened db2 and the new startup form.

I don't know why, but it appears that the form itself retained the path of the folder where it was created, even after moving the mdb to a different folder. Creating the form in Folder2 fixed the problem for me.