natb
Jan 22 2008, 08:22 PM
I have an image control that displays a linked jpg image for every different record. The filenames are not stored in a table, but are searched for using vb script:
[ImageFrame].Picture = "C:\FootWise Podiatry\Database\FootDiagrams\diagram_" & PatientID & ".gif"
What I would like to do is be able to double-click on the image, and for it to open in an image editor (I'm trying with MSPaint (C:\WINDOWS\system32\mspaint.exe), but Microsoft Photo Editor or any other program would do).
How can I achieve this without having to use OLE embedding (I will be having over 3,000 records, so storage space is an issue), and how can I direct the image editing program to open the specific image for that record?
Thank you!
GroverParkGeorge
Jan 22 2008, 08:28 PM
Welcome to UtterAccess.
You can create a hyperlink field in an Access table, in which you could store the path to the image. Clicking on that hyperlink would open the image. You could place that in a control below the image.
Another option is to place the following in the Double-Click event of the image control.
Application.FollowHyperlink "C:\FootWise Podiatry\Database\FootDiagrams\diagram_" & PatientID & ".gif"
George
Edited by: GroverParkGeorge on Tue Jan 22 20:30:02 EST 2008.
natb
Jan 22 2008, 09:05 PM
Thanks for your suggestion.
The FollowHyperlink event allowed me to view the image in my web browser, but how can I open the image in an image editor (I need to be able to edit and modify the image, hence why MSPaint would be a suitable application)?
Thank you again!
Edited by: natb on Tue Jan 22 21:07:24 EST 2008.
freakazeud
Jan 22 2008, 09:16 PM
Hi,
instead of the followhyperlink method try the shell method.
HTH
Good luck
ChrisO
Jan 22 2008, 09:45 PM
When it comes to image files, these days it appears we can’t even rely on the ShellExecute API call.
So, like Oli says, it might be best to force it with the old Shell function: -
CODE
Private Sub ImageFrame_DblClick(Cancel As Integer)
If Len(Me.ImageFrame.Picture) And Me.ImageFrame.Picture <> "(none)" Then
Shell "C:\Windows\System32\MSPaint.exe " & Chr(34) & Me.ImageFrame.Picture & Chr(34), vbMaximizedFocus
End If
End Sub
Hope that helps.
Regards,
Chris.
natb
Jan 23 2008, 08:21 PM
Thank you so much to both freakazeud and ChisO.
It works!
I've spent so long trying to find the right code, so I really appreciate it!
Cheers,
Nathania
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.