473,467 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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
Nov 13 '05 #1
4 13692
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" <sh**********@hotmail.com> wrote in message
news:3a**************************@posting.google.c om...
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

Nov 13 '05 #2
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" <sh**********@hotmail.com> wrote in message
news:3a**************************@posting.google.c om...
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

Nov 13 '05 #3
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" <sh**********@hotmail.com> wrote in message
news:3a**************************@posting.google.c om...
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


Nov 13 '05 #4
Wow - three different ways. I'll try all three.

thanks.
Shumit
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John Fryatt | last post by:
Hi, Before I go on, let me just say I'm fairly new at this so excuse me if I say the wrong thing or use the wrong term. Anyway, what I am trying to do is to set up something where I can have a...
1
by: Dan | last post by:
I must develop a (C-sharp) winforms application which should display some relatively large (e.g. 2~5 MB JPEG each) photographic images together with a rich set of related information: the...
0
by: Jerry J | last post by:
I have a third party image viewer that can display various types of images. The image viewer is ActiveX and lives inside of Internet Explorer. To get the image viewer to retrieve an image, java...
4
by: Troy | last post by:
Hi all, Im a little new to ASP.NET. I'm looking to create an image viewer that zooms in, pretty common. But I need to draw a box on the 1:1 scale image and 'zoom in' on another picture box. ...
1
by: Kuldeep | last post by:
Hello All, Could you please give me some leads on building a Image Viewer in .NET or how to use Windows Picture and Fax Viewer. The actual purpose is to display the image in my web application...
1
by: zee | last post by:
hello Is it possible to use Document Image Viewer Control in ASP.NET(2.0) because 1. The IDE is not adding this component in the toolbox and 2. when i use it so it give me following error ...
0
by: Andrew | last post by:
Hello Ive been messing around with a simple raw image viewer using Pil and Tkinter However I am running into problems displaying the images they appear to be not correct I believe it is cause of...
4
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all I need to do a image viewer, just to view and zoom pictures in jpeg. I do not need to edit or save the picture. I am sure, there are some controls already made. I am thankful for any...
0
by: marcellus7 | last post by:
Im looking for an image viewer that supports most types of image formats, including PDFs, and has the ability to rotate/zoom, and draw on an image. I've been looking but to no avail. Does anyone have...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.