Search and Open from file pathway

NobelWheat

New Member
Joined
Jan 11, 2023
Messages
3
Office Version
  1. 2016
  2. 2007
Platform
  1. Windows
I am looking to create a form in Access 2016 that I can type a pdf name into and have it open that pdf from a separate folder with a button click
I created a Text box to use as my "Search Bar" but I am having difficulties getting access to open the pdf

I need this to be able to open the files from the server location as this is shared information between all departments

Example
"123.PDF" would be the name of the file I am trying to open from the folder, there for I would type "123.PDF" into my TextBox and then click a button and have "123.PDF" open

Thank you in advance for any help!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I mistyped in my original post, "123" would what I want to type into my TextBox not "123.PDF"
 
Upvote 0
Consider using the msoFileDialogFilePicker utility, which will then return the path of the chosen file. You can use that result in your code to open the file. You must have code for this that builds the file path string, because you can't expect a file to be found without the folder path and file extension, as in "123"? Maybe step through your code and examine the path you're creating in code. Perhaps use Debug.Print to print your path to the immediate window where you can examine it.
 
Upvote 0
I have Google on this laptop.

Plenty of examples here open a pdf file in access vba - Google Search

Why reinvent the wheel? Pick one closest to what you want to do.
I have over 10,000 .pdfs that are all stored on a server that I would rather not put into my access database due to size concerns; I want to be able to reference the pdf name in a text box and have it open the one I am looking for on the form. I have also tried searching on google and other message boards, but I was not able to find what I am after.
 
Upvote 0
I have also tried searching on google and other message boards, but I was not able to find what I am after.
So what exactly are you after?
It is just a path plus a file name?

Simplest is you know the path, so that could be hardcoded.
You know the same, as you are going to type it into a textbox.
So a concatenation of both and open with Shell command for instance, FollowHyperLink maybe ?

Now if you want part of a filename entered, that would be more complicated.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top