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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Liniking pictures

Status
Not open for further replies.

rh8

Programmer
Jan 28, 2001
4
GB
I would like to include a field in a table to include a address of a picture file and in a report for it to show the picture, is there any way to link the content of a picture to the content of a field, if this is not possible is there anothour way to do this?
Thank you very much.
RH
 
If I understand your question right, you want to link a graphics file to a record in your database. You want the picture to be displayed both in a form and in a report.

One easy way to set it up:

Create a field with type OLE in your table called "picture".

On your form create a bound OLE frame called "OLEBound1" its control source should be the table field "picture".

On your form create a command button with the following code in the on click event...

Private Sub Command1_Click()
DoCmd.GoToControl "OLEBound1"
DoCmd.RunCommand acCmdInsertObject
End Sub

This will open the insert object dialog and allow you to browse to locate the picture file.

You will have to decide whether to "Link" (store only the path to the file) or "Embed" (store the entire file in the database). Generally you will want to link as this keeps the size of the database down and ensures that you view the latest version of the graphics file). With linking however if the file is deleted then you wont be able to see it in your database anymore.

You will also want to look at the propertys for the ole frame to have it apear and behave the way you want.

Key properties are:

Size Mode - You probably want "zoom" or "stretch"

Autoactivate - if set to "double click" allows you to open the file in the native application for viewing and editing by double clicking the frame on the form.

Display Type - Content shows the actual picture as opposed to an icon.

When you create your report, you will place an OLEframe on it also. The properties available for the frame on the report work the same as those on the form.


Another approach ...

If you have an established dirrectory structure such that all files will have a certain name and location that you can predict, there are ways to have access go out and find the graphics file based on other information in the database record. This involves some deeper programing and would require additional information on your application.

Good Luck

Dave
gallagherd@earthlink.net
 
There are three different ways to integrate graphic files in Access (see solutions page on the powerup website). Which approach fits you best depends on the nature of your application.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top