Results 1 to 8 of 8
  1. #1
    Iain is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Location
    Aberdeenshire, Scotland
    Posts
    42

    Shell command to open a file with Windows picture viewer

    I've been trying to find a construct for Access 2007 that will run a subroutine from an OnClick event on a button, that will open an image file using the Windows Picture and Fax viewer in XP.



    The full file path including the file name and extension is stored in the database.

    None of the online searches have produced fruitfull results and so far, none of the example codes have got past the compile stage.

    Any suggestions on how I might approach this?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Maybe this link will help: http://access.mvps.org/access/api/api0004.htm
    What is the extent of the picture (JPG etc...)? What is the default viewer for that type of file on your system?

  3. #3
    help_me_with_access is offline help_me_with_excel
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    262
    Iain,

    you know, the other thing you can do is simply create a shortcut to your picture viewer exe, move the shortcut to your "system32" folder and then in visual basic just type:

    Code:
    shell "pictureviewer " & path
    you wouldn't have to bother with api code, changing your default image program or anything else! Or for that matter, just hard code the path to the picture viewer...or let the user pick the location...

  4. #4
    Iain is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Location
    Aberdeenshire, Scotland
    Posts
    42
    All JPG. Default viewer is the windows picture and faxt viewer.

  5. #5
    Iain is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Location
    Aberdeenshire, Scotland
    Posts
    42
    I started along these lines but I'm using the Windows XP default viewer and I can't find out what the exe file is called.

  6. #6
    Iain is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Location
    Aberdeenshire, Scotland
    Posts
    42
    I tried the line of code you suggested with another application exe and it compiles ok but the sub routine just skips over it.

  7. #7
    help_me_with_access is offline help_me_with_excel
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    262
    wow, did not know that windows pic viewer is apparently not an exe? hmmmm...take a look at the trick they pulled in post #8 here:

    http://www.softwaretipsandtricks.com...er-hiding.html

    don't have time to code, but you can probably work it out from there if you want to go that route!

  8. #8
    Iain is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Location
    Aberdeenshire, Scotland
    Posts
    42
    No luck. the #8 solution generates a 'file not found' error just like any of the other application exe files.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Running a shell command from a stored procedure.
    By sstrauss87 in forum SQL Server
    Replies: 3
    Last Post: 03-01-2012, 04:39 PM
  2. Replies: 4
    Last Post: 08-29-2011, 12:36 PM
  3. mdb file won't open in Windows 7
    By Nice in forum Access
    Replies: 2
    Last Post: 02-16-2011, 12:42 PM
  4. Replies: 11
    Last Post: 10-01-2010, 11:12 PM
  5. Open (shell) a program and pass a file
    By Olszanski in forum Programming
    Replies: 2
    Last Post: 07-27-2010, 03:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums