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 
Open specific Attachment
Carol Herriot 
    
5 years ago
You showed us how to Browse Attachment Folder using a Command Button.  Is there a way to open a specific attachment with the Command Button?  Each record has a different attachment within the Attachment Folder.
Richard Rost  @Reply  
          
5 years ago
I'm not following. Can you please elaborate? Maybe post a screen shot?
Adam Schwanz  @Reply  
            
5 years ago
Try this Shell Command otherwise there is a more elaborate seminar HERE
Carol Herriot OP  @Reply  
    
5 years ago
Sorry.  Hope this helps.  I have 40 records in my database.  Each one has a .pdf associated with it.  I would like the Button to open that specific .pdf
Carol Herriot OP  @Reply  
    
5 years ago

Richard Rost  @Reply  
          
5 years ago
You would need to use the ShellEx function. It's a little more involved. I cover it in the Seminar that Adam suggested.
Carol Herriot OP  @Reply  
    
5 years ago
I DID use the ShellExec Functions as you covered in the Opening Other Programs Lesson 3.  I even used your sample database and it too opens to C:\Attachments as in the screenshot above.


Carol Herriot OP  @Reply  
    
5 years ago

Adam Schwanz  @Reply  
            
5 years ago
Attachment is the name of the field

If Right(Attachment, 4) = ".PDF" Then
        Shell """C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe"" """ & Attachment & """", vbNormalFocus
End If
Carol Herriot OP  @Reply  
    
5 years ago
I am getting very confused.  In the example above from Lesson 3, clicking on "Browse Attachments Folder" is NOT meant to open the Attachments, only direct you to the folder for browsing.

Are you saying that the code you included above will open specific files within the Attachment Folder E.g. C:\Attachments\bellevue.pdf)?  If so,  how do I declare ShellExec? AND use the VBA code?
Adam Schwanz  @Reply  
            
5 years ago
You see that field C:\Attachments... on that picture? If that field name is called Attachment you can use the code I listed to open it. It needs to be the full network address c:\attachments\filename.pdf
Scott Axton  @Reply  
        
5 years ago
Carol
I think you are suffering from information overload.
In Lesson 1 Richard uses Shell to start us out with using other programs.
Then in lesson 3 he switches over to the ShellExec which uses the Windows handler (shell32.dll).
Both do basically the same thing.  They open the file using another program.
I think you're trying to mash the two together.

So... For Shell YOU tell Access what program to use to open the file.  
ShellExec you let Windows decide which program to use based on the file extension.

In Lesson 2 Richard shows how to open each individual file based on extension
using the On Dbl Click.
To use that feature using the ShellExec you would just substitute the correct code to open that particular file.

If you want to select the file and then click a button to open that file refer back to
Beginner Level 7 - Lesson 5 where Richard shows how to select a Customer from a list then open that customer
in a form using the Open Selected Customer button.
Scott Axton  @Reply  
        
5 years ago
Instead of opening a customer you would be passing the file name to the ShellExec.

A little different but same concept.
Richard Rost  @Reply  
          
5 years ago
Carol, you are correct. The BROWSE Attachments Folder is meant for you to BROWSE the folder to select a file.

If you want to OPEN that file to view it, use ShellExec. Exactly HOW to use it is all explained in the videos.
Carol Herriot OP  @Reply  
    
5 years ago
I have FINALLY been successful in opening my two attachments (Instruction Sheet and Video) using the ShellExec Function!!
Using a Subform allows me open both attachments specific to each record.  Using a Command Button however, only allows me to open the SAME Instruction Sheet and the SAME video for EVERY record.

Is there a way to open these attachments specific to the record using a Command Button?  Please see the screen shots that show how I have declared ShellExec.

Carol Herriot OP  @Reply  
    
5 years ago

Richard Rost  @Reply  
          
5 years ago
Yep. Put your buttons in the form footer of your subform. Then all you would need is:

ShellExec LocationFieldName

Then all you have to do is click on the record and then click the button.

Working with subforms starts in my Access Expert 3 class.
Carol Herriot OP  @Reply  
    
5 years ago
Thank you for your video on hyperlinks.

I was successful with email and filelocation.  However, I received an error message for the webBtn.  Please see screen shot.  My computer WAS connected to the internet.

Is this something that is covered in the extended cut for this video?
Carol Herriot OP  @Reply  
    
5 years ago

Richard Rost  @Reply  
          
5 years ago
That's odd. Let's see what's in Web. MsgBox it.
Alex Hedley  @Reply  
           
5 years ago
If you MsgBox "http://" & Web what shows?
Carol Herriot OP  @Reply  
    
5 years ago
see screenshots.  I am not sure I did the msgbox correctly.
Carol Herriot OP  @Reply  
    
5 years ago

Carol Herriot OP  @Reply  
    
5 years ago

Richard Rost  @Reply  
          
5 years ago
What's the NAME of the "webpage address" text box?
Carol Herriot OP  @Reply  
    
5 years ago
webpage
Carol Herriot OP  @Reply  
    
5 years ago

Richard Rost  @Reply  
          
5 years ago
There's your answer. :)
Carol Herriot OP  @Reply  
    
5 years ago
errr . . . . . I do understand
Carol Herriot OP  @Reply  
    
5 years ago
sorry  I DON'T understand
Richard Rost  @Reply  
          
5 years ago
If the NAME of the text box is "webpage" then that's the name you have to put in your code.

Application.FollowHyperlink "http://" & WebPage

You don't have any field on your form called Web, but that's what you have in the code. They have to match.
Richard Rost  @Reply  
          
5 years ago
Either change the code to WebPage OR change the name of the box to Web. Get it now?
Carol Herriot OP  @Reply  
    
5 years ago
Thank you soooooo much.  I didn't understand that before.

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/6/2026 12:04:25 PM. PLT: 1s