Form Button Application opening file

G

Guest

I have a database which holds the path to image files and
related data.

I'd like to open the current records image file into a
viewing application,the path is stored in a field called
PATH.

I have the app opening with this code, but can't get the
file to load into the app.

stAppName = "c:\program files\volo view\voloview.exe"
Call Shell(stAppName, 1)


Thanks in advance.
 
G

Glenn Suggs

Hi Steve,

I'm not familiar with the voloview app you mentioned but many applications
allow you to pass the name of the file you want to open as a parameter
(argument) when you start the application. In this case, your code would
look something like this:
stAppName = "c:\program files\volo view\voloview.exe" & " " & strFileToOpen
Call Shell(stAppName, 1)

where strFileToOpen is, of course, the name of the image file. However,
complications can occur if you have spaces in the name of the file.

On the other hand, I wrote an app earlier this year totally in Access where
the complete file name (including path) is stored in a table with other info
and when the user makes a selection, the file is loaded into a picture box on
a form and displays very nicely. Access supports several image file types
you can use with this method.

Good luck!
Glenn
 
D

Douglas J. Steele

To avoid problems with spaces in the names, put quotes around the strings
that contain the path to the executable and to the file:

stAppName = Chr$(34) & "c:\program files\volo view\voloview.exe" & _
Chr$(34) & " " & Chr$(34) & strFileToOpen & Chr$(34)
Call Shell(stAppName, 1)

Another option is to use the ShellExecute API call. See
http://www.mvps.org/access/api/api0018.htm at "The Access Web" for details.
(One real advantage of using ShellExecute is that you don't need to know
where the executable's located)
 
S

Stewphen Hoey

Thanks Glenn, Works great (exaclty what I wanted) but I
am having the problem with the space for directory names -
Do you know of a way around that?
 
6

'69 Camaro

Hi, Steve.

Use Doug Steele's suggested syntax, instead of Glenn's. You won't have any
problems with the spaces in the directory names or file names.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Any human can read my reply E-mail address and should alter it so that a
message will be forwarded to me. Spammers are free to use my UNALTERED
reply E-mail address. I will *never* get those messages!)
 

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