Solved

Open Folder in Access form button with VBA

Posted on 2013-01-16
7
559 Views
Last Modified: 2013-01-16
Experts,
I am trying to open a folder on a drive by assigning vba code to a button on my Access form.

If I hard code this path works fine.  When I try to assign a variable I get and error path doesnot exist.  Any ideas on what I am doing wrong??

Works fine......
Shell "explorer /e, C:\SystemProjectFiles\Ashland", vbNormalFocus

Not working.....
Shell "explorer /e, " & FolderPath & """, vbNormalFocus"

Thanks,
Bob
0
Comment
Question by:RobertStamm
[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
  • 4
  • 3
7 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38783924
try

followhyperlink "C:\SystemProjectFiles\Ashland"
0
 

Author Comment

by:RobertStamm
ID: 38783951
That works but I need to turnoff the hyperlink warning message.  Any ideas on how to do that?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38783955
ok try

Shell("explorer.exe C:\SystemProjectFiles\Ashland",4)

or


Shell("explorer.exe C:\SystemProjectFiles\Ashland",vbnormalfocus)
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

by:RobertStamm
ID: 38783979
This gets me back to my orginal question....who do I write the statement to replace C:\SystemProjectFiles\Ashland with a variable called FolderPath?
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 38784032
Dim FolderPath As String
FolderPath = "C:\SystemProjectFiles\Ashland"

Call Shell("explorer.exe " & FolderPath, 4)

or

Shell "explorer.exe " & FolderPath, 4
0
 

Author Comment

by:RobertStamm
ID: 38784442
Perfect....Thanks for your help.
0
 

Author Closing Comment

by:RobertStamm
ID: 38784448
Thanks again!
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Outlook 2016 VB code syntax 4 37
Microsoft exchange 2010 issue 1 19
SQL using aggregate function with HAVING / WHERE clause. 8 49
SUBFORM on ACCESS 2013 8 33
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

734 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