Re: Cannot run a file from Access



"David W. Fenton" <XXXusenet@xxxxxxxxxxxxxxxxxxx> wrote in message
news:Xns992DB7C2BD45f99a49ed1d0c49c5bbb2@xxxxxxxxxxxx
"Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx> wrote in
news:u2zhBy7kHHA.3280@xxxxxxxxxxxxxxxxxxxx:

\DIR\File.pdf isn't a complete reference to a file. You need
either a drive letter, or a \\server\share in front of that.

Are you sure? Won't Windows resolve it relative to the current
directory?

In testing, I found that any valid path that is begun *not* with a \
is OK, dependent on the current directory (CurDir() returns this).

So, if the directory named "DIR" is in the current directory, then
this should work:

As you've stated, there are differences between \DIR\File.pdf and
DIR\File.pdf.

\DIR\File.pdf should work, as long as the current drive is correct. (As an
aside, how come there's a ChDrive command, but no CurDrive one?)

DIR\File.pdf should work, as long as the current directory is correct. A
common problem, though, is that CurDir usually isn't what the user (or
developer) thinks it is.

Shell("Dir\ExecutableFile.exe")

Of course, how an argument passed to an executable is handled will
depend on how that executable is written.

In the case of trying to open a data file, I'd use the ShellExecute
API, instead (using Dev's HandleFile wrapper,
http://www.mvps.org/access/api/api0018.htm).

Any particular preference to that API over FollowHyperlink? (Just asking: I
usually use the API, but since it's easier to use FollowHyperlink I've
started recommending that instead)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)



.



Relevant Pages

  • Re: Cannot run a file from Access
    ... ShellExecute API, instead (using Dev's HandleFile wrapper, ... Any particular preference to that API over FollowHyperlink? ...
    (microsoft.public.access.gettingstarted)
  • Re: Cannot run a file from Access
    ... will this work in Access 97 - The computers this database runs on is ... either a drive letter, or a \\server\share in front of that. ... API, instead (using Dev's HandleFile wrapper, ...
    (microsoft.public.access.gettingstarted)
  • Re: Cannot run a file from Access
    ... either a drive letter, or a \\server\share in front of that. ... Won't Windows resolve it relative to the current ... dependent on the current directory (CurDir() returns this). ... API, instead (using Dev's HandleFile wrapper, ...
    (microsoft.public.access.gettingstarted)
  • Re: FBWF API using C++
    ... Is it possible to get the drive letter by the function ... I think FBWF lacks that functionality but you may try EWF API instead: ... Otherwise just stick to regular Win32 VolumeManager API: GetVolumeNameForVolumeMountPoint, ...
    (microsoft.public.windowsxp.embedded)
  • Mount a Device
    ... intentional,since I want my application to prompt the user to assign ... I am trying to assign a drive letter when a device is inserted. ... I am aware that I need to use SetVolumeMountPointAPI to set the ... How can I use it in GetVolumeNameForVolumeMountPoint() API. ...
    (microsoft.public.win32.programmer.kernel)

Loading