Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 13th, 2005, 02:30 AM
Shumit Rehman
Guest
 
Posts: n/a
Default opening an image viewer

Hi

I have a table which has path names to photos I would like to view. I
would like to open some/any kind of image viewer(Paint) to see the
picture when I click the pathname.

The pictures are mostly scanned newspaper atricles which are too big
to just display on a form so I need the zoom and scroll features.

Im using access 2003

thanks in anticipation
Shumit
  #2  
Old November 13th, 2005, 02:30 AM
Larry Linson
Guest
 
Posts: n/a
Default Re: opening an image viewer

See help for the Shell statement... that will open another program, and you
can specify "command line parameters", too, so you should be able to open an
image processing program on the file whose path and filename you have
stored.

Larry Linson
Microsoft Access MVP

"Shumit Rehman" <shumitrehman@hotmail.com> wrote in message
news:3a2b6094.0408010649.6be5fe3b@posting.google.c om...[color=blue]
> Hi
>
> I have a table which has path names to photos I would like to view. I
> would like to open some/any kind of image viewer(Paint) to see the
> picture when I click the pathname.
>
> The pictures are mostly scanned newspaper atricles which are too big
> to just display on a form so I need the zoom and scroll features.
>
> Im using access 2003
>
> thanks in anticipation
> Shumit[/color]


  #3  
Old November 13th, 2005, 02:30 AM
Don Leverton
Guest
 
Posts: n/a
Default Re: opening an image viewer

Hi Shumit,

How about this idea?:

1.) Modify your table so that you store your FilePath string as a Hyperlink.
2.) Design a form based on this modified table
3.) Add an Image Control (Size Mode = Zoom) on this form that will allow you
to "preview" the image as you navigate from record to record.
4.) The file path for the hyperlink could be set using Dev's FileOpenSave
Common Dialog API http://www.mvps.org/access/api/api0001.htm
5.) The hyperlink can be used "dual purpose"...
Clicking on it will open the image in the default viewer assigned for files
of that type,
and if we trim out the "#" signs, it can also be used to set the .Picture
property of the Image control.

If this sounds good, here is the code that you'll need...

****************** Main Module (DB Window) Code ******************
-- I'd suggest pasting this code into the same module as the FileOpenSave
API

'------------------------------------------------------
Function GetGraphic()
' Requires FileOpenSave API code
' from http://www.mvps.org/access/api/api0001.htm

Dim strFilter As String

strFilter = ahtAddFilterItem(strFilter, "TIFF Files (*.tif, *.tiff)",
"*.TIF; *.TIFF")
strFilter = ahtAddFilterItem(strFilter, "JPEG Files (*.jpg, *.jpeg)",
"*.JPG; *.JPEG")
strFilter = ahtAddFilterItem(strFilter, "GIF Files (*.gif)", "*.GIF")
strFilter = ahtAddFilterItem(strFilter, "WMF Files (*.wmf)", "*.WMF")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
'You could add more file formats using the pattern above.

GetGraphic = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=1, _
DialogTitle:="Select Graphic File to Import")

End Function

'------------------------------------------------------
Function StripChar(MyStr As String, RemoveChar As String) As Variant
On Error GoTo StripCharError

Dim strChar As String, strHoldString As String
Dim i As Integer

' Exit if the passed value is null.
If IsNull(MyStr) Then Exit Function

' Exit if the passed value is not a string.

If VarType(MyStr) <> 8 Then Exit Function

' Check each value for invalid characters.
For i = 1 To Len(MyStr)
strChar = Mid$(MyStr, i, 1)
If strChar = RemoveChar Then
' Do nothing
Else
strHoldString = strHoldString & strChar
End If
Next i

' Pass back corrected string.
StripChar = strHoldString

StripCharEnd:
Exit Function

StripCharError:
MsgBox Error$
Resume StripCharEnd
End Function

******************** Form (Class) Module Code *********************

Option Compare Database
Option Explicit

'------------------------------------------------------
Private Sub cmdImportFileNames_Click()
On Error GoTo Err_cmdImportFileNames_Click

Dim strFile As String
strFile = GetGraphic 'Call the function

Me![FilePath] = "#" & strFile & "#" ' The pound signs are required by the
hyperlink

Me![ctlImageFrame].Picture = StripChar(Me![FilePath], "#") 'But the pound
signs mess up the .Picture :(
Me.Refresh

Exit_cmdImportFileNames_Click:
Exit Sub

Err_cmdImportFileNames_Click:
MsgBox Err.Description
Resume Exit_cmdImportFileNames_Click

End Sub
'------------------------------------------------------

Private Sub Form_Current()
On Error Resume Next

If IsNull(Me![FilePath]) Then
Me![ctlImageFrame].Picture = "C:\Art\CAMERA.TIF" 'I use this to indicate
that no picture is available
Else
Me![ctlImageFrame].Picture = StripChar(Me![FilePath], "#") 'Remove the
pound signs, which mess up the .Picture
End If

End Sub
************************************************** **********


"Shumit Rehman" <shumitrehman@hotmail.com> wrote in message
news:3a2b6094.0408010649.6be5fe3b@posting.google.c om...[color=blue]
> Hi
>
> I have a table which has path names to photos I would like to view. I
> would like to open some/any kind of image viewer(Paint) to see the
> picture when I click the pathname.
>
> The pictures are mostly scanned newspaper atricles which are too big
> to just display on a form so I need the zoom and scroll features.
>
> Im using access 2003
>
> thanks in anticipation
> Shumit[/color]


  #4  
Old November 13th, 2005, 02:31 AM
Stephen Lebans
Guest
 
Posts: n/a
Default Re: opening an image viewer

You can easily achieve Zoom/Scroll for your Images within the standard
Access GUI.
See:
http://www.lebans.com/loadjpeggif.htm

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"Shumit Rehman" <shumitrehman@hotmail.com> wrote in message
news:3a2b6094.0408010649.6be5fe3b@posting.google.c om...[color=blue]
> Hi
>
> I have a table which has path names to photos I would like to view. I
> would like to open some/any kind of image viewer(Paint) to see the
> picture when I click the pathname.
>
> The pictures are mostly scanned newspaper atricles which are too big
> to just display on a form so I need the zoom and scroll features.
>
> Im using access 2003
>
> thanks in anticipation
> Shumit[/color]

  #5  
Old November 13th, 2005, 02:37 AM
Shumit Rehman
Guest
 
Posts: n/a
Default Re: opening an image viewer

Wow - three different ways. I'll try all three.

thanks.
Shumit
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles