Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image in Form to Open Irfanview

Status
Not open for further replies.

TimTang

Technical User
Jun 24, 2002
132
TH
Hi All,

I've got another challenge for the Access guru's.

I've got a vessel location map in my vessel location form frmPosition (finally after days of frustration and agrivation). So far it seems the work OK.

The map is a little to small to read the details but you can get the general idea where the vessel is, was, or where it's going. I'd like to enlarge the map if I want to take a closer look so on the map frame I've added a double click event to open the map in Irfanview.

I can get Irfanview to open but I don't now how to pass the map file onto the event.

Here's the Code so far

Code:
Private Sub img_V_Map_DblClick(Cancel As Integer)

On Error GoTo Err_imgMap_DblClick

    Dim stAppName As String

    stAppName = "C:\Program Files\IrfanView\i_view32.exe"
    Call Shell(stAppName, 1)

Exit_img_V_Map_DblClick:
    Exit Sub

Err_imgMap_DblClick:
    MsgBox Err.Description
    Resume Exit_img_V_Map_DblClick
    
End Sub

Does anyone have an idea how I can accomplish this?

Cheers!!
 
Perhaps:

stAppName = """C:\Program Files\IrfanView\i_view32.exe"" ""C:\Docs\ThisMap.Ext"""
 
Thanks again Remou!

That's kinda' what I thought. I'll have to Dim a couple variables Dim imgPath, imgMap as String then concatenate them within double quotes.

I think!

I'll give it a try when I get home tonight and let you know.

Do you ever get any sleep!

If you're ever in Bangkok, beers are on me.

Cheers!!
 
Hi Remou,

I tried your suggestion but I can only get so far. The img file and the path are stored as 2 different string and I'm having difficulty concatenating them. this is what I've got so far:

Code:
Private Sub img_V_Map_DblClick(Cancel As Integer)
On Error GoTo Err_img_V_Map_DblClick
Dim strMapPath As String
Dim stAppName As String

strMapPath = Me.strMaplocation & Me.str_V_Map
        
stAppName = "C:\Program Files\IrfanView\i_view32.exe"
Call Shell(strAppName & strMapPath, 1)

Exit_img_V_Map_DblClick:
    Exit Sub

Err_img_V_Map_DblClick:
    MsgBox Err.Description
    Resume Exit_img_V_Map_DblClick

End Sub

I'm not sure what I'm doing wrong; probally syntax

Also if you know of a good tutorial that teaches syntax for concatenation that would be great!
 
Try:

[tt]Result = Shell(strAppName & " " & strMapPath, vbNormalFocus)[/tt]

If IrfanView is your registered viewer for this type of file,

FollowHyperlink strMapPath

will also work.
 
Hi Remou,

I finally got it to work but I had to steel code from an example in the FAQ section. This is what it looks like:

Code:
Private Sub img_V_Map_DblClick(Cancel As Integer)
On Error GoTo Err_img_V_MapDblClick
Dim strMapPath As String
Dim strAppName As String

strMapPath = Me.strMaplocation & Me.str_V_Map

strAppName = "C:\Program Files\IrfanView\i_view32.exe "

Call Shell(strAppName & Chr(34) & strMapPath & Chr(34), vbMaximizedFocus)

Exit_img_V_MapDblClick:
    Exit Sub

Err_img_V_MapDblClick:
    MsgBox Err.Description
    Resume Exit_img_V_MapDblClick

End Sub

Well it's great that it works but not so great that I'm not exactly sure why!

Anyway...

Thanks again for your assistance.

By the way...how do you award stars to the MVP's that help?

I don't know how it's done so I probably look like a real shmuck for not showing my appreciation.

Cheers!!
 
I think you will find that what you were missing in your earlier post was the space between the application name and the file name. I should have remembered that file paths with spaces require quotes. You will also need to add quotes to application paths with spaces.
 
how do you award stars to the MVP's that help
Click on the 'Thank xxx for this valuable post' link and follow the instructions.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top