Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
FollowHyperlink
Robert Stott 
    
3 years ago
I have two sets of two buttons on a form:
(1)The first set has a Pick button that opens a dialog window where  to choose and save the path to a field 'FolderLocation' The Associated button is to open a dialog window to that fold where I am able choose a file to open.

DetailsPrivate Sub FilePathBtn_Click()
On Error GoTo Err_FilePathBtn_Click
With Application.FileDialog(msoFileDialogFilePicker)
.Show
Me!FolderLocation = .SelectedItems(1)
End With
Exit_FilePathBtn_Click:
Exit Sub
Err_FilePathBtn_Click:
MsgBox Err.Description
Resume Exit_FilePathBtn_Click
End Sub
Private Sub OpenFolderBtn_Click()
Application.FollowHyperlink Me.FolderLocation
End Sub


(2)The second set has a pick button that a dialog window where  to choose and save the path to a field 'LocationFilePath'  The associated button is open that specific file (usually a PDF).

DetailsPrivate Sub OpenFolderBtn_Click()
On Error GoTo Err_OpenFolderBtn_Click:
Application.FollowHyperlink Me.FolderLocation
Exit_OpenFolderBtn_Click:
Exit Sub
Err_OpenFolderBtn_Click:
MsgBox Err.Description
Resume Exit_OpenFolderBtn_Click
End Sub
Private Sub OpenFileBtn_Click()
Application.FollowHyperlink Me.LocationFilePath
End Sub


The difference is that one set pick the opens folder path, the set pick pat and opens' a specific file.
All Four have common problem: If I cancel the dialog widow (rather than 'OK') it error's out 'The expression you entered has an invalid reference to the Parent property' but doesn't cause a debug error. Otherwise (1) work correctly.
(2) The an associated, 'Pick' button is to open a file from a folder, that I choose and saved in a field 'LocationFilePath'; it works accept for the cancel thing. The other button is supposed Open the specific file but error's out. The 'Error is '90' (cannot open the specified file)'.
Am using the wrong approach


Scott Axton  @Reply  
        
3 years ago
See this post: Error on Cancel
You just need to handle the error if someone hits cancel or doesn't pick a file.

Check out the links in the Code Vault Pick a File with FileDialog
Robert Stott OP  @Reply  
    
3 years ago
I used this before but could get it save the Path + the file name. I want to go to the Dialog Window and work my way to the folder that hold the file I want and save the whole path in the field so I can open the file any time without searching through the file structure.
Kevin Robertson  @Reply  
          
3 years ago

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/7/2026 4:50:44 AM. PLT: 0s