Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 19th, 2009, 11:54 AM
Authorized User
Points: 71, Level: 1
Points: 71, Level: 1 Points: 71, Level: 1 Points: 71, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2009
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
Default Run PDF Reader and PDF file with Cmd Button

I created a database which contains the names of scanned magazine articles saved as PDF files. I give each PDF a descriptive name which I store in the Subject field. I placed a text box on my form to display the Subject text which is named txtSubject. What I want to do is place a command button on the form that when clicked will run my PDF reader (FoxitReader) and open the PDF whose name is stored in txtSubject for the currently displayed record. I am doing this now using a separate text box set as a hyperlink, but this requires typing in the entire path to the PDF which I would rather not do. I have used the Shell function to open the PDF reader program by itself, but I can't figure out how to write the VBA code that would use the text string in txtSubject to open the specific PDF for the current record. Can this be done? I am a VBA novice. Any help would be greatly appreciated.
 
Old April 20th, 2009, 01:21 PM
Authorized User
 
Join Date: Jul 2008
Location: Portland, OR, USA.
Posts: 38
Thanks: 1
Thanked 2 Times in 2 Posts
Default

If your PDF Reader is the default then you should be able to use this (as long as the entire path is in txtSubject). If not you would need to create the path first.

FollowHyperLink Me.txtSubject
__________________
Thanks,

Bob Larson
Access MVP (2008-2010, 2011)
Free Access tutorials, samples, tools
 
Old April 21st, 2009, 07:04 AM
Authorized User
Points: 71, Level: 1
Points: 71, Level: 1 Points: 71, Level: 1 Points: 71, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2009
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Thanks, Bob. Your code worked like a charm and I've learned somthing new. My PDF's pop up instantly now.
 
Old April 21st, 2009, 12:43 PM
Authorized User
 
Join Date: Jul 2008
Location: Portland, OR, USA.
Posts: 38
Thanks: 1
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by RodM View Post
Thanks, Bob. Your code worked like a charm and I've learned somthing new. My PDF's pop up instantly now.
Glad to hear! :)
__________________
Thanks,

Bob Larson
Access MVP (2008-2010, 2011)
Free Access tutorials, samples, tools




Similar Threads
Thread Thread Starter Forum Replies Last Post
convert HTML File to PDF file in vb.net gaurikhot .NET Framework 2.0 4 June 16th, 2014 02:33 AM
Code to Run PDF Maker DevDaniel Excel VBA 0 March 26th, 2007 08:49 AM
bookmark a PDF file with Acrobat Reader/OpenOffice crmpicco Need help with your homework? 0 February 27th, 2006 01:13 PM
AcroPDF.PDF.1 object for detecting Acrobat Reader crmpicco Javascript How-To 0 December 1st, 2005 08:26 AM
Need to open a PDF with a command button RayL Access VBA 2 January 27th, 2004 12:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.