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 
Opening a Folder
Colin Smyth 
      
4 years ago
I have a bird database. I use Richard's browse code to select a photo of a bird from a folder on my hard drive and that then places the photo in my database but leaves the photo on my hard drive. I want to be able to open the folder of a particular bird to view all the birds in the folder before I select one. I can use the browse button to open the folder, but I then need to right click on one of the photos and open it with Windows Photo viewer and I can then scroll through all the photos to choose which photo I want. Is there a way to automate this process or is this the only way it can work? Thanks for any advice.
Kevin Robertson  @Reply  
          
4 years ago
You could add an additional button to your form to review your images and enter the following in the Click event of the button.
Modify the path to suit your needs.

Dim Filename As String
Filename = "C:\Users\" & Environ$("username") & "\Pictures"
Application.FollowHyperlink Filename
Colin Smyth OP  @Reply  
      
4 years ago
Thank you Kevin. That works well.

Is there a way that I set up an input box to type the name of the folder I want and then have Windows automatically open the photos in that folder. I know how to type Inputbox, but not sure how to then tell windows to open that folder in windows photo viewer.l
Thank you for your assistance - still pretty new to VBA
Dan Jackson  @Reply  
            
4 years ago
I'm stealing this, thanks!
Kevin Robertson  @Reply  
          
4 years ago
Colin,

Am I understanding you correctly?
You want to open each of your images in a specific folder in Windows Photo Viewer?

If this is what you are meaning, you have to ask yourself:
"If I have 100 images in the folder, do I really want 100 instances of Windows Photo Viewer opening all at once?"

It is possible but I don't recommend it for a folder with many images.
Colin Smyth OP  @Reply  
      
4 years ago
Hi Kevin. I have a folder for each different bird on my hard drive. I have a folder called "photo album". Under that folder there is a folder say for "Magpie" which contains a limited number of photos for that bird. So there are a few hundred folders in the Photo album folder each containing photos of a specific bird. I want to be able to open say the Magpie folder and just view all the photos of that bird, one after the other using Windows Photo viewer - scroll through them one by one. Your code above opens the Photo Album folder. My question is can I use some code to input Magpie and it then opens that folder called Magpie and then automatically opens the first photo in Windows photo viewer. Hope that is a little clearer. Thank you for your assistance.
Kevin Yip  @Reply  
     
4 years ago
Colin, you can have Access open up a "file picker", which looks like Windows File Explorer where you can see thumbnails of all the pics in the folder (screenshot below).  I don't know if Richard's course taught you that.  But here is the VBA code to open up that file picker:

Dim fd
Dim fc As Integer, fn As String
Set fd = Application.FileDialog(3)    ' 3 = file picker; 4 = folder picker.
fd.InitialFileName = "C:\My Folder"    ' Starting folder you open to.
fd.AllowMultiSelect = False      ' User can only pick one file.
fd.Show
fc = fd.SelectedItems.Count
If fc > 0 Then                 ' If user picked a file
    fn = fd.SelectedItems(1)    ' then fn is the FULL PATH of the selected file; otherwise fn is an empty string.
End If

This method makes use of the "FileDialog" property which you can read more about here:
https://docs.microsoft.com/en-us/office/vba/api/access.application.filedialog
Scott Axton  @Reply  
        
4 years ago
Rabid Follower-

Please see the Access Forum Posting Rules  # 3 .

Links to images and MOST outside sources are not allowed.  This is to prevent broken posts, viruses, and unsavory picture posts.

BTW - What would you like to go by?  We are on a first name basis here and typically aliased accounts are not allowed.  I hate saying "hey you".

I'll get Richard or Alex to edit you post this time.
Scott Axton  @Reply  
        
4 years ago
BTW - You can upload images here by clicking the link in the original post.

See Image Uploads.
Richard Rost  @Reply  
          
4 years ago

Richard Rost  @Reply  
          
4 years ago
I posted the image here for you. Yeah, I've got a pretty strict policy on links. I don't mind page links to Microsoft or other Access Forums, but I had this one guy a few years ago post a link to a JPG online that was fine at the time he posted it. Someone complained to me a few months later that it was a pornographic image. He switched it after it was approved. I'm not saying YOU would do that, but since then I've taken a strict policy on images. You can upload whatever you like here.
Colin Smyth OP  @Reply  
      
4 years ago
I am using the coding that Kevin supplied at the top of this post to open a folder to see all the folders of each of the birds in their individual folders. So the coding that I use is as follows:
Dim Filename As String
    Filename = "E:\My Pictures\Birds\" & Environ$("username") & "\Photo Album"
    Application.FollowHyperlink Filename
So this opens the folder "Photo Album"
Within this folder are multiple folders - a separate folder for each bird and there maybe up to 10 photos of that one bird in that folder for that bird. So I then have to scroll down to find the specific folder for that bird.
I have a form (which I have attached) which opens a bird and displays the photo on the page. However I may have other photos of that same bird, that it would be good to scroll through and see them all.
Is there a way I can add to the above code to open to the specific folder of the bird that is open on the form?
Colin Smyth OP  @Reply  
      
4 years ago

Colin Smyth OP  @Reply  
      
4 years ago

Kevin Robertson  @Reply  
          
4 years ago
The easiest way would be to store the folder name in the table. Otherwise you'd be looking at looping through the contents of each of the folders in the 'Photo Album' folder to find the current filename.
Colin Smyth OP  @Reply  
      
4 years ago
Hi Kevin. The folder name is the same as the name of the bird. eg All my photos of the "Australian Reed Warbler", are in a folder called "Australian Reed Warbler". So can I just use the field name of the bird to somehow open the folder of the same name?
Kevin Robertson  @Reply  
          
4 years ago
Great. That makes it easy. I see from your images the bird name is in a combo box so you could do something like this:

Filename = "E:\My Pictures\Birds\" & Environ$("username") & "\Photo Album\" & ComboBoxName.Column(1)
Colin Smyth OP  @Reply  
      
4 years ago
Hi Kevin.  I have tried playing around with it but not working. The combo Box doesn't have a name as such as it is set up under lookup on the "Bird Name" field  in the table and is based on a query. Tried using the field name instead but then it brought up an error on the last line of the original code i.e. Application.FollowHyperlink Filename. Might just have keep doing the clumsy way I have been doing it.
Scott Axton  @Reply  
        
4 years ago
Colin -
Your Combo box has a name whether you gave it one or not.  Take a look at the properties for your Bird Name combo.
In the All tab, at the very top, it will say something like "Combo20".  That is where you can give it a meaningful name.
Instead of Combo20 you could type in BirdNameCombo.  (No spaces in the name!)
Now you can use that in the example Kevin provided.

Filename = "E:\My Pictures\Birds\" & Environ$("username") & "\Photo Album\" & BirdNameCombo.Column(1)

You don't have to rename the combo but it will help "future you" to remember what that is should you use it anywhere else.
Colin Smyth OP  @Reply  
      
4 years ago

Colin Smyth OP  @Reply  
      
4 years ago
Hi Kevin and Scott. I have attached a copy of the table where the combo box is actually set up - there doesn't seem to be a place where it can be named. I did try on the form, changing the property of where the bird name is place to BirdNameCombo, but it still just opened the Photo album folder and not the specific bird folder.
Kevin Robertson  @Reply  
          
4 years ago
Combo boxes really shouldn't be set up that way. Evil Access Stuff.

Relational Combo Boxes - this will make life much easier in the future.

Since you already have this built (if you don't want to change it) I would say your only other option would be DLookup to look up the bird name.
Kevin Robertson  @Reply  
          
4 years ago
I would suggest you continue to watch Richard's classes in order.
Complete the Beginner Series.
Then the Expert Series.

I think you may be missing a lot of fundamentals when it comes to proper database design.
Colin Smyth OP  @Reply  
      
4 years ago
Hi Kevin. You are probably right. I actually got this information, i.e. the way it is set up when I was listening to another online guy before I found Richard's videos. There have been a few things that I have had to change as I have gone along after watching Richard's videos. Might have to see if I can change this situation as well, but will probably take a bit of work but might be worth it in the long run. Thank you for your help - really appreciate your advice.
Scott Axton  @Reply  
        
4 years ago
I agree with Kevin's comments above - 100%.  
Can you put the lookup in the table? - Sure and it will work.  However, the best way, the methods that Richard teaches, are to put it in a separate table.  Things become more simple and easier to use.  This is one example.

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: 6/17/2026 10:43:29 AM. PLT: 0s