Open PDF Reader and PDF File with Cmd Button

RodShinall

Registered User.
Local time
Today, 14:47
Joined
Dec 21, 2006
Messages
32
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.
 
What you need is a look up table that contains at least 3 fields.

Primary Key
Descriptive name of the pdf file
The path and file name to the pdf file.

If the path is always the same then this could be stored in another table and simply use the actual file name.

Then create a form that lists the descriptive names in a list box. When the user selects a pdf you use the shell function to open up the pdf file automatically.

This has been discussed before on this forum. Depending on the version of Access you are using will determine the approach you need to take.

David
 
Thank you, David. This is an interesting approach; I'll try it.
 
What you need is a look up table that contains at least 3 fields.

Primary Key
Descriptive name of the pdf file
The path and file name to the pdf file.

If the path is always the same then this could be stored in another table and simply use the actual file name.

Then create a form that lists the descriptive names in a list box. When the user selects a pdf you use the shell function to open up the pdf file automatically.

This has been discussed before on this forum. Depending on the version of Access you are using will determine the approach you need to take.

David


David,

I'm trying to do something similar; I have a combo box which displays the descriptive names of the files and when the user clicks on them the file will open.

I have the full file path, file name in a separate table from my main table, and a field: "Well name". In the main table there is this same field set as the primary key, and is linked to the secondary table in a 1 to many relationship.

I want the combo box to only display the files for the corresponding record, but right now, it displays all the files in the secondary table. how can I do this?

Many thanks in advance, I really need help here as my boss is bugging me to get this database done soon.



Stef
 
Here is a demo of a find files app. It lets you browse to any location set any filters or file extensions. Then it lets you do various things with the files. Hope this helps you.

David
 

Attachments

Users who are viewing this thread

Back
Top Bottom