Opening images in another program on click?

S

Sarengo

Hello,

I have a form with an image that updates depending on what a user selects
from a combo box. eg. If user selects 1, image1 will show, user selects 45,
image 45 shows, etc. We've recently changed some of the pictures but have
kept the naming understandable. ie. image1A, image1B, image1C...

Users wanted to be able to zoom in, so I had the image open up in a new
window when it is clicked. However, this leaves no room to navigate. Users
wanted to be able to access the old images as well. eg. image1C opens, but
they want to be able to go back to image1B or image1A.

The images are saved in a separate folder in the same location as the
database, so I think the easiest way would be to have the image open up in a
program that people can navigate with, such as Microsoft Office Picture
Manager. Most of the users are used to using Windows Picture and Fax Viewer
so they prefer it to open on this, but it's a bit.....nit-picky and odd.

It would also be great if I could get a message box that tells the user how
many images there are of each list selection. eg. user selects 1, msgbox says
"There are a total of 3 images: image1A, image1B, image1C."

Is this possible to do? Suggestions?
I thank everyone in advance for their help and patience!

Note: I am fairly new to Access (using 2007)
 
J

Jack Leach

I think both tasks should be doable... I can give some vague guidance but not
the complete details

For the number of items in the list, that depends on the structure and
controls you are using I suppose, but you can probably use DCount with a
criteria somewhere alone the lines of "Like 'image1*'" to return the count of
all records that are formatted like that.

As far as opening the pics, I generally use ShellExecute to open files, but
I go with the registered program rather than a specified program. You may be
able to do it with the ShellExecute API (go to mvps.org/access and look in
their API section for a good copy), but I know you can use the built-in Shell
function to open a specific program... in this case MSO Picture Viewer. You
will need the path to that executable, along with whatever commandline
switches it might take to open the specified file. I don't know these
details off the top of my head, but it might look something like this:

Shell """C:\Path\PicViewer.exe /pic C:\otherpath\image1a.jpg"""


There's two problems with the above that you might have to do some work on
though... 1) the executable might not be the same on each user's computer,
and 2) each user might use a different program

#2 can be worked around by storing a record for the computer as to which
executable to run. For instance, comp name THISCOMP will use MSOPicViewer
and THATCOMP might use WinPicFaxViewer (or something haha). Anyway, before
executing the Shell function, you would consult this table with the name of
the current system and feed the correct executable to the function.

#1 can be worked around as well. After you have the name of which program
to run (from #2 - and yes, I should have numbered them opposite what I did
but too lazy to go back and change it), somewhere out there is an API that
will retrieve the executable path for a given program. I've seen it (and at
one point used it), though I would have to do some serious digging to come up
with it again.


So, based on all this, what you are looking for is possible. Although, it
might be a bit more that you're willing to chew (some if this stuff is pretty
deep for the beginner). If you do have interest in following this path, let
me know and I'll see what I can do to get you going.

hth

--
Jack Leach
www.tristatemachine.com

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

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