Solved

Open Folder in Access form button with VBA

Posted on 2013-01-16
7
542 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

806 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