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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.