Command button opens picture

Montemontgo

Registered User.
Local time
Today, 04:06
Joined
Oct 25, 2004
Messages
26
In a form of my famous people database I have a command button which should open the appropriate picture. All pictures are stored in a separate folder "E:\stamps". What would be the command line so that instead of "Beethoven" it will use the string displayed in the field "surname" of the form.

Private Sub Comando7_Click()
On Error GoTo Err_Comando7_Click

Dim stAppName As String

stAppName = "E:\iview336g\i_view32.exe E:\stamps\Beethoven.jpg"
Call Shell(stAppName, 1)

Exit_Comando7_Click:
Exit Sub

Err_Comando7_Click:
MsgBox Err.Description
Resume Exit_Comando7_Click

End Sub
 
Do you need to use IrFanViewer to view your pics? Although it's a quality viewer and free, wouldn't Access' own image field be sufficient for your needs?

If it would then I would suggest -

1. In an admin page somewhere in your database, have the facility to input and store the usual path name where the Images are to be stored.
This is so that if you ever change your file location you only have to change the path name once....e.g. "E:\Stamps\" This would be stored as a field in an admin table somewhere that could be retrieved easily. e.g. PicLocation

2. The "surname" field in the data table would hold the Imagename.

3. Then use the statement -

stAppName = PicLocation & Me!surname
Call Shell(stAppName, 1)

Would that serve your needs?

Dave Eyley
 
Thanks Dave, no I am not fixed on Irfan View. It's just that I know this viewer while I have no clue about Access' own possibilities. All I really want is to store the pics in jpg-formate and in a separate folder and not inside the database. So, I'm going to try your suggestion. - But I did not succeed -
 
Last edited:
Add an image control to your form and try something like this in the click event of your command button...

Code:
Me.YourImageControl.Picture = "E:\stamps\Beethoven.jpg"

You can use this to grab the value in a text box to display the picture related to a record...

Code:
Me.YourImageControl.Picture = Me.YourTextBox
 
Thanks ghudson,
could you just have that done for me in my small demo database?
 

Attachments

Users who are viewing this thread

Back
Top Bottom