Solved

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

Posted on 2013-05-26
3
582 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 465 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

SendBlaster Pro 4 - Bulk Email Sending Software

SendBlaster 4 Pro - Best Bulk Emailing Sending Software
Automatic Subscribe / Unsubscribe Processing
Great for Newsletters & Mass Mailings
Optional HTML & Text Composition
Integration with Google Features
Built in Spam Score Checking
Free Professional Templates - Feature Packed!

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
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…

759 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