Access and Hyperlinks

M

mb

I have a form with an id field and several buttons that when clicked will
take a user to a directory with many jpeg files. Each id will have many jpeg
files. I would like to open the directory where the jpegs are housed and take
the user to the first jpeg for the specific id. The id numbers are in the
format 000-000-00 the jpeg file names are in the format 000-000-00-2X-A.jpg
and 000-000-00-2X-B.jpg and 000-000-00-2X-C.jpg etc.
I can open the directory but I am having problems taking the user to the
first file for the id. Any suggestions/recommendations are welcomed. Thanks
in advance for your help.
 
J

Jack Leach

I'm not sure that you can select (highlight) a file in explorer through vba,
but here's a few ideas that might essentially accomplish the same thing...

1) You can open the file directly using Application.FollowHyperlink, Shell,
or the ShellExecute API found at mvps.org/access. Shell and ShellExecute
would allow you to specify the command to perform on the file (Open, Print,
Edit, etc.)

2) Fill a list box with all of the files for that particular directory, at
which point you will have the capability of automating a file selection
(which can then be executed per note 1)

Allen Browne has a nice procedure for programmatically filling a list box
with files of a directory (this is recursive for subfolders as well...)

http://allenbrowne.com/ser-59.html

hth

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
D

David H

What do you mean by 'taking the user to the first file'? Are you wanting to
automatically open the image? Are you wanting the first image to be selected
in the file browser?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top