Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access 2007 capturing hyperlink in form using VB Script - open to correct folder

Posted on 2013-05-26
3
Medium Priority
?
588 Views
Last Modified: 2013-05-27
I am running the following VB Script to capture a hyperlink to a file.  I need the code that will tell the button to open to a specific folder.  The folder I want to use is

\\crserver2\inboxes\

The current code is this:

Private Sub Command5_Click()

On Error GoTo Err_Command5_Click

Me.[Attachment].SetFocus
DoCmd.RunCommand acCmdInsertHyperlink

Exit_Command5_Click:
    Exit Sub

Err_Command5_Click:
    If Err.Number = 2501 Then
        Resume Next
    Else

        MsgBox Err.Description
        Resume Exit_Command5_Click
    End If
End Sub
0
Comment
Question by:SoundBytes
  • 2
3 Comments
 
LVL 20

Expert Comment

by:GrahamMandeno
ID: 39198228
I'm not clear about what you are actually asking.  Do you want to open an Explorer window on the given folder?  If so, use FollowHyperlink:
Application.FollowHyperlink "\\crserver2\inboxes\"

-- Graham Mandeno [Access MVP 1996-2013]
0
 
LVL 20

Accepted Solution

by:
GrahamMandeno earned 1860 total points
ID: 39198288
Or, if you want to select a file from that folder, use some code like this:
Dim fd As Object
Dim strFilename As String
  Set fd = Application.FileDialog(3) ' msoFileDialogFilePicker
  With fd
    .Title = "Select a file"
    .AllowMultiSelect = False
    .InitialFileName = "\\crserver2\inboxes\"
    If .Show = 0 Then
      MsgBox "You clicked Cancel"
      Exit Sub
    Else
      strFilename = .SelectedItems(1)
    End If
  End With
  Set fd = Nothing
' go ahead and do something with strFilename

Open in new window

-- Graham
0
 

Author Closing Comment

by:SoundBytes
ID: 39199526
Like a charm dude!  Thanks!!!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Quickbooks hosting can do wonders to your enterprise but considering the points elaborated in the article which will help you to better analyze the outcomes. So scan your business, its needs and then move to the new world of limitless benefits.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question