Solved

Open Folder in Access form button with VBA

Posted on 2013-01-16
7
551 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
  • 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
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.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

821 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