Hyperlinks in Access Table

We currently have a hyperlink field in a Microsoft Access 2013 Table.  

To populate the field, we have the following code:

    Dim filesys
    Dim FromPath1 As String
    Dim ToPath1 As String
    If Len(Dir("T:\Completed Jobs Library - New System\" & [QuoteID], vbDirectory)) = 0 Then
        FromPath1 = "T:\Completed Jobs Library - New System\Master Job Folder"
        ToPath1 = "T:\Completed Jobs Library - New System\" & [QuoteID]
        Set filesys = CreateObject("Scripting.FileSystemObject")
        filesys.CopyFolder Source:=FromPath1, Destination:=ToPath1
    End If
    Me.DocumentLink = "C:\Completed Jobs Library - New System\" & [QuoteID]

I then have an on click event for the field on the form:
    If Me.DocumentLink Is Not Null Then
        Shell "C:\WINDOWS\explorer.exe """ & Me.DocumentLink & "", vbNormalFocus
    End If

I placed this on the server and now we receive the following error(See Attached "Error on Server")

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.

I'm not sure what "this" is.  Are you running the app on the server?

I don't use the Hyperlink data type because it cannot be upsized.  It violates first normal form since it mushes multiple attributes into a single column.  I use regular text data types and then in code use the FollowHyperlink method.  The advantage of this is that as long as you are linking to a registered file type, Windows will open the correct application.  With shell, you not only need to know what .exe you need to run, you also need to know where it is and that can be problematic in an environment where everything is not identical.  The downside is that you don't get to substitute descriptions for the actual file name.  Also, for certain types of links such as files associated with specific customers or audits, etc, I frequently define a path for the files in a different table.  So for example, in one app that manages insurance audits, I have a separate path for each audit and so the Audit table is where that is stored.  In another app, I keep documents for clients so the path for each client is stored in the client record.  That way, when I log the document I only need to store the actual file name.  This makes it pretty easy to move the folders around if necessary.

strTemp is populated with whatever the link is.  It could be a file name for a document stored on your server or it could be the name of a web page.  Anything valid as a link will work.
Application.FollowHyperlink strTemp

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
btgtechAuthor Commented:
This is a button within a form on in an Access app on a server.

The button is intended to create the directory to save the job documentation to.

There is already a master folder which we are making a copy of in the code and then assigning the link to the hyperlink field.

I will definitely try the FollowHyperlink method.

Jeffrey CoachmanMIS LiasonCommented:
It looks like yo are creating a string value anyway,...
So I don't see the need to store this in a hyperlink field.
...also I am not sure what that large block of If/Then code is doing at the top of your code...

FWIW, your code works fine for me "as is"
...are you sure you code is generating a valid string/Path?

Try displaying the value in a message box:
 If Me.DocumentLink Is Not Null Then
        msgbox Me.DocumentLink
        'Shell "C:\WINDOWS\explorer.exe """ & Me.DocumentLink & "", vbNormalFocus
 End If

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 Access

From novice to tech pro — start learning today.