How to create a hyperlink to an Outlook 2010 ".msg" file in an Access linked SQL Server table?

I'm trying to open a ".msg" outlook file saved on a hard drive from a Microsoft Access form with it's recordsource being a linked SQL Server 2012 table. If I doubleclick the file in Windows Explorer it opens via Microsoft Outlook. I set the form textbox as a hyperlink but I can't set the data type of the field to hyperlink in Ms Access.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

On the form, add a button.In Command Button Wizard, choose Application, then Run Application (this from Access 2003)  Make up one and get to finish. It will open a code window with something like:
Private Sub Command7_Click()
On Error GoTo Err_Command7_Click

    Dim stAppName As String

    stAppName = "abc"
    Call Shell(stAppName, 1)

    Exit Sub

    MsgBox Err.Description
    Resume Exit_Command7_Click
End Sub

Open in new window

Replace all of that code with this, but replace the line it that says,
"Private Sub Open_Click()" with whatever your button name was. Example from code generated above
would be:
"Private Sub Command7_Click()"

Option Compare Database

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
                                                                               ByVal lpOperation As String, _
                                                                               ByVal lpFile As String, _
                                                                               ByVal lpParameters As String, _
                                                                               ByVal lpDirectory As String, _
                                                                               ByVal lpnShowCmd As Long) As Long

Private Sub Open_Click()
On Error GoTo Err_Open_Click

    ShellExecute 0, "open", txtDocPath.Value, 0, 0, 1

    Exit Sub

    MsgBox Err.Description
    Resume Exit_Open_Click
End Sub

Open in new window

You may have to tweak it in the code, but it works for me.

Also it expects a textbox named txtDocPath. If yours has a different name you will need to change that in this code to match.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pabrannPresidentAuthor Commented:
Worked like a charm, thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.