Open a file outside Access

Eikenhorst

Registered User.
Local time
Today, 10:59
Joined
Mar 9, 2007
Messages
25
Hello,

I’m working on a complaints database. For some complaints a photo of the complaint can be more clarifying. I have a code that checks if there is a photo linked to the opened complaint and if it does I want this to open, in a program like the Windows Picture and Fax Viewer. But I doubt if this is possible, I couldn’t find an VBA statement that would allow me to open a file.

The code I have until now is the following:
If Len(Dir("T:\Quality Assurance\Reg\Complaints\Pictures\" & Me.Combocomplaintnumber & ".JPG")) > 0 Then
‘Open the file in Windows Viewer
End If

I could of course open a new form with just this picture placed in it, or something like that. But that doesn’t allow me to zoom in. I hope anyone could help me with this, any help is greatly appreciated!
 
use the shell or shellexecute function to run a program or open a file such as .doc .xls .bmp, .jpg etc
 
Thanks for your help. I immediately tried it out. I now have the following code:
If Len(Dir("T:\Quality Assurance\Reg\Complaints\Pictures\" & Me.Combocomplaintnumber & ".JPG")) > 0 Then
Shell “T:\Quality Assurance\Reg\Complaints\Pictures\" & Me.Combocomplaintnumber & ".JPG"
End If

This should work, but I get an error message saying “Invalid procedure call or argument”. Could it be that I can’t run this argument with Microsoft Visual Basic?
 
The shell command will require the program as well as the filename whereas the shell execute will open the file using the file association as explained in the help system.
 
Thanks again!

Unfortunately I can't run the ShellExecute function in VBA. It just doesn't know it for some reason.
So now I have it that it is opening the Windows Viewer, but I can't make that to open the specified picture. How do I link the program and the filename?

I have got the following code now:
Shell "C:\WINNT\system32\rundll32.exe C:\WINNT\system32\shimgvw.dll,ImageView_Fullscreen"
And I would need something like this: Shell "C:\WINNT\system32\rundll32.exe C:\WINNT\system32\shimgvw.dll,ImageView_Fullscreen, T:\Quality Assurance\Registraties\Klachtenverwerking\Afbeeldingen\" & Me.Comboklachtnummer & ".JPG"

Please help me with this last stap.
 
Sorry I found the solution :cool: I needed a space insteat of a comma. It works now, thanks again!
 

Users who are viewing this thread

Back
Top Bottom