Connecting Tech Pros Worldwide Help | Site Map

Linking to an access record from an email

Newbie
 
Join Date: Aug 2007
Posts: 31
#1: Dec 18 '08
Hello,

I've developed an access database to track work against team plans and organizational objectives.

I'm trying to implement a feature but I'm not sure where to start. I'm wondering if there is any way of opening a database at a specific record by using a hyperlink in an email.

For example, I want users to be able to receive an email like

"I've assigned this task to you. Please check it out on the database (hyperlink)"

Is there any way of passing arguments to Access in this way?
Any suggestions appreciated.
puppydogbuddy's Avatar
Expert
 
Join Date: May 2007
Location: Florida
Posts: 1,915
#2: Dec 18 '08

re: Linking to an access record from an email


see this link for code that might help you get started, and give you something that you can adapt and build on.

Access Reading Outlook E-Mails from Access
Newbie
 
Join Date: Aug 2007
Posts: 31
#3: Dec 19 '08

re: Linking to an access record from an email


Hi,

Thanks for the reply, Puppydogbuddy.
I'm a little confused as to how to start with this one; am I right that this bit of code actually monitors the inbox?

The database wouldn't always be open, so I wonder if there would be any way of passing arguments from a hyperlink in an email to start the database and then go to a specified record?

I'd rather not tamper with my colleagues' inboxes if possible!
puppydogbuddy's Avatar
Expert
 
Join Date: May 2007
Location: Florida
Posts: 1,915
#4: Dec 22 '08

re: Linking to an access record from an email


OK, here is an example that I found on a public forum. The code is credited to Jim Everist. I do not know HTML, so I leave it to you to modify the HTML to the specifics of your application. As to opening your database to a specific record, you can use the OpenForm of the DoCmd with a where clause argument....
For example (assuming where clause returns a text value), DoCmd.OpenForm "YourForm",,, "[SomeField] = '" & YourVariable & "'"


Expand|Select|Wrap|Line Numbers
  1. 'Set the mail .BodyFormat to HTML (= olFormatHTML) and then use HTML tags inside of the .HTMLBody property like this:
  2.  
  3. Sub SendFileLink()
  4. Dim sSubject As String, sBody As String, sEmail As String
  5.  
  6. sSubject = "Test File Hyperlink Email"
  7. sBody = sBody & "This is the filename link:" & vbCrLf
  8. sBody = sBody & "<A href=""file://server-name/share/folder/folder/folder/file""><FONT face=Verdana size=2>filename</FONT></A>"
  9. sEmail = "emailname@company.com"
  10.  
  11. Dim oApp As New Outlook.Application
  12. Set oApp = New Outlook.Application
  13.  
  14. Dim oMail As Object
  15. Set oMail = oApp.CreateItem(olMailItem)
  16.  
  17. oMail.BodyFormat = olFormatHTML
  18. oMail.HTMLBody = sBody
  19. oMail.Subject = sSubject
  20. oMail.To = sEmail
  21.  
  22. oMail.Send
  23.  
  24. Set oMail = Nothing
  25. Set oApp = Nothing
  26.  
  27. End Sub
Reply


Similar Microsoft Access / VBA bytes