Provide file explorer functionality to open PDF's

Lateral

Registered User.
Local time
Today, 01:08
Joined
Aug 28, 2013
Messages
388
Hi guys

I'm a newbie and using Access 2007.

I have added functionality that creates a report, saves it as a PDF, and then sends it to a customer via email as an attachment. The PDF file is saved to a folder and is named to include the Customer's unique customer number and the date and time the PDF was created.

For example, if the customer number is 09 and the date was 10th October 2013 and the time 09.00am, the file name is 0009101020130900.pdf.

What I want to be able to do from within the database is to have a button, that when clicked, will display all of the Pdf's for only customer number 09. The customer number will be based upon a field in the customer record.

Can somebody please help me with a step by step?

Thanks for any help you can provide.

Regards Greg
 
Are they all saved into the same folder?

You could use the DIR() function and fill a list box.

You could loop through all the files.
Use
Left(filename, 4) = CustomerNumber (+ padding)
And only add it if it matches.

Or Open Explorer:
VBA
Shell "C:\WINDOWS\explorer.exe """ & Foldername & "", vbNormalFocus
 
Hi Alex

Yes, they are all in the same folder. I'll have a play around and let you know how I go.

Thanks
Regards
Greg
 
Hi again Alex,

I'm having trouble do what you suggested.

Would you mind posting the complete set of code?

I assuming that it would be attached to the "On Click" event?

Also, am I correct in assuming that I would need another button to actually "open" and view the selected PDF file?

Thanks for any help you can give.

Regards
Greg
 
Hi Greg,

I'll find some time to put something together.

In the meantime do you have any of the code you tried? It would be handy to see your thought process and can help with the learning process.

Did you get any functionality working?

Sometimes it's good practice to try writing it all out in pseudo code first then building it up step by step.

Also instead of using variables write it in hardcoded values first.
i.e. Add a listbox to the form. Make it a Value List, add the full path and filename of a sample PDF then use that as your working example.
You can then build upon adding variables and loops etc to make it dynamic.

Alex
 

Users who are viewing this thread

Back
Top Bottom