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

How do I allow users to easily link graphics to records.

Forms

How do I allow users to easily link graphics to records.

by  DaveSH  Posted    (Edited  )
To create a button that will allow users to link and display an image (graphics file) on a form.

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

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

3) 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 properties 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.

If you create a report, you can place an OLEframe on it also. The properties available for the frame on the report work the same as those on the form.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top