Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help with listbox issue

Posted on 2013-01-29
5
Medium Priority
?
299 Views
Last Modified: 2013-01-30
About a week ago an expert helped me with a question that involved having the ability to open PDF files from a form.  I want to take this a little bit further and have the user have the ability to open a PDF file, by double clicking the record in a listbox.  Please see the attached Access file.  Note that only PDF files will ever be used with this database.

The way I see this working is this...

1)  A program administrator would add the files/records to the database via the use of the form, "frmLinkedPDF".  These files in real use would be on a network server but for now for testing I'm just using a folder on my computer.

2)  Then the end user would use the form "Form1" to select the PDF file they want to open/view/print.  They would do this by double-clicking the item in the listbox.

I need help with the doubleclick event of the listbox.

--Steve
PDF-Attachment-Example.accdb
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 48

Expert Comment

by:Dale Fye
ID: 38830917
I cannot open your attachment, company policy, but I would use the FollowHyperlink method.  Assuming that the listbox displays the path\name of the file, I would use the double click event of the list and put the following code in that event:


    Application.FollowHyperlink  me.YourListControlName
0
 

Author Comment

by:SteveL13
ID: 38830958
I entered...

    Application.FollowHyperlink Me.List0

in the on doubleclick event of the listbox but it doesn't work.

Here is what happens:

1) I get a message popup indicating that a potential securoty concern has been identified. Hyperlinks can be harmful....etc.   (I wouldn't want this to appear)

2) It also reads "Do you want to continue?  When I click [Yes] I get runtime error 490 - Cannot open the specified file.

???
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1000 total points
ID: 38831002
use Shell


Private Sub List0_DblClick(Cancel As Integer)
Dim strPdf As String
strPdf = Me.List0.Column(2)
Shell "C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe " & strPdf, vbNormalFocus
End Sub
0
 
LVL 48

Assisted Solution

by:Dale Fye
Dale Fye earned 1000 total points
ID: 38831463
The Followhyperlink method works fine for me running Access 2007 on Windows 7 platform.

The "cannot open the specified file" error is an indicator that the value in the listbox is not the full path to the file.

It looks like capricorn1 was able to open your file and found that the filename is in the third column of your listbox, so try:

Application.Followhyperlink me.list0.column(2)
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 38835713
Glad to help.  So, which method did you go with?  The advantage of the FollowHyperlink method is that it will open the file in the default application associated with that file type.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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.

609 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