General discussion

Locked

Access or VB and .Tif pictures

By BBG ·
How can I simply display a Tif picture on an Access form or in VB6 on a form there, via any ACCESS or VB6 code or components or Windows API? Please note that a program that can view Tif files may or may not be on the user's PC - the only things thatmay be on the PC is the OS and any VB6 / MS Access run time files or components. So, I am not sure if a object container will work when there are no programs associated with a Tif file.
The user will either see the Tif on the form when the form opens, or have to click on a button on the form to open a window in order to view the Tif picture.

This conversation is currently closed to new comments.

13 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Access or VB and .Tif pictures

by BBG In reply to Access or VB and .Tif pic ...

Point value changed by question poster.
The last 50 points that I have available.....

Collapse -

Access or VB and .Tif pictures

by BBG In reply to Access or VB and .Tif pic ...

Point value changed by question poster.

Collapse -

Access or VB and .Tif pictures

by Bob Sellman In reply to Access or VB and .Tif pic ...

I assume that you want to display a different picture for each record in a table, since you can easily set up (in Access) an image control on a form (or report) and just select a picture to display in the control.

Let's assume the image control (which you set up initially with a fixed picture) is called image1. You need another control (that can be invisible if you want) to hold the path and filename of the image file (such as a TIF image as you mention). Let's name that control txtFileName.

Here's the trick. For the OnCurrent property of the form, put in the following code:

me.image1.Picture=me.txtFileName

When you enter this code you will NOT be given Picture as one of the property options. Ignore that fact and just type in the word "Picture". For some reason, Access does not provide that in the list of properties that you can define values for, although the above code will work fine.

Obviously, if you show the filename/path and allow the user to change it you will want to put the same code in the OnUpdate property of the control txtFileName.

Collapse -

Access or VB and .Tif pictures

by Bob Sellman In reply to Access or VB and .Tif pic ...

Actually, I have no problem displaying a .TIF file in Access 97. You might try starting the install of Access again and be sure to load all of the appropriate graphic converters, etc. When Access was installed on your system the necessary graphicsfiles to display TIF files may not have been included. I also assume you have updated to the latest version also.

Collapse -

Access or VB and .Tif pictures

by BBG In reply to Access or VB and .Tif pic ...

Thanks for the response. I found out Access DOES use OLE to connect with another program like Corel or Kodak in order to display a Tiff file. It cannot do it alone, or with the files installed by the set-up program. If you can prove me wrong then I will send the same points your way.

My goal was to be able to diplay a TIFF in VB6 prg, and if Access can do it then VB6 can as well (one way or another).

Collapse -

Access or VB and .Tif pictures

by BBG In reply to Access or VB and .Tif pic ...

To answer #1: Thanks for your response!
But these things I have long known (because I use VB also).
My problem is not assigning a file name to an image control, but showing the picture in it - I am assuming that the image control in ACCESS just cannot display a TIF picture - but there must be someway of doing it.

Have any idea?

By the way, all properties of all controls can be accessed by doing a loop through the property collections - you will find, esp. in ACCESS, many properties that do not automatically show up:

Public Sub ShowProperties()

Dim prop As Property
For Each prop In Image12.Properties
Debug.Print prop.Name
Next prop

End Sub

Put this in the code window of the form class, call it on the form and call it form the form activate event.

Collapse -

Access or VB and .Tif pictures

by BBG In reply to Access or VB and .Tif pic ...

Point value changed by question poster.

Collapse -

Access or VB and .Tif pictures

by BBG In reply to Access or VB and .Tif pic ...

To Answer #1:
I am still leaving your answer unrated because I do not want to just reject it with-out giving you a chance to respond again, if you want to.
I think what you are using is the OLE image control, and not a true picture control. The difference is the fact that this type of container is an OLE container - meaning - simply putting it for this case - it links and uses other programs to do something. If You do not have a program on your system registered to open a type of file, then this container will not be able to display it. I can open a Tiff file with it if something like Corel Print house is installed on the system - in which case Corel takes over the task of diplaying the picture. If I don't, then the picture cannot be displayed via this OLE container - or image control (image control is a wrong discription for this container). If you have a PC, with-out on program on if that can open a Tiff file, and load Access, I doubt that you will be able to load a Tiff file in it. I even believe Word uses an OLE container for Tiff files.
A (simple) picture box will display an image with-out the need of using another program to open it. It is capable of opening the file it self (such as JPEG, Gif, Bmp. But it doesn't seem to be capable of opening a Tiff file.

I have been shown where to find some code in "Planet Source Code" - and it works for most picture file types - except it is erroring out for Tiff files so I am going to try and get in contact with the author, who has kindly offered this code, to get this corrected.

If you still think that I am wrong, then please show me what I am not doing right - it would be greatly appreaciated! I would be more than willing to increase the points (I need to first collect some more)

Thank you!

Collapse -

Access or VB and .Tif pictures

by sl-campbell In reply to Access or VB and .Tif pic ...

You cannot. You need a program installed on your PC that is capable of displaying Tiff files (the picture box cannot - only through OLE, and for this, you need a program on your PC that can display Tiff files.......).
Or you need some 3rd party component (Ocx or what ever I haven't found one yet that doesn't cost for the distribution license, and if it is Freeware, then it doesn't work for Tiff pictures).

Or you can create your own (complicated).

But almost every Windows OS can display Tiff pictures with the basic tools/extras installed. Why not go the OLE route?
If it doesn't work on the user's PC, then tell them to load the Extras from the Windows CD.....

Collapse -

Access or VB and .Tif pictures

by sl-campbell In reply to Access or VB and .Tif pic ...

This tip was in another forum recently:

Have a look at the Kodakimg or Wangimg exe and ocx's. They are included in every Windows OS set-up (under Extras). With the Exe installed you will always be able to display Tiff files through OLE.
You can go a step further and write a dll (or put it right in your application) using the ocx's that come with it which enable the user to view, edit, scan-in all types of picture files including Tiff.
There are sample programs avaiable (I use NT and there are samples on the CD.

Back to Web Development Forum
13 total posts (Page 1 of 2)   01 | 02   Next

Related Forums