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

photo display

Status
Not open for further replies.

ccs2

Instructor
Oct 8, 2003
37
GB
I have set a field as OLE and got the bitmaps. I have a form and subform based on a select query. The OLE field is part of the subform. I want the photo to appear on the main form each time a record is selected in the subform.

In an attempt to do this I have put the OLE field in the footer of the subform and the created a link from a text box in the main form along the lines of =sbfConvoy!Photo (Photo being the name of the OLE field). This does not work. However when I view the subform independently in Form View the Photo is displayed. Any suggestions would be welcome.

CCS
 
ccs2,

Storing OLE images in a table is not really recommended.

I don't think you achive what you are attempting by storing the image. At least not without saving and converting.

Easiest solution:
Create a default folder to hold the images instead of the table, change your OLE control in the table to a text control, and store the path and image name.

On your Main Form:
Add an Image Control sfrmImage - Pick any image to create it. Save it, look at the properties and delete the path to image used to create it. "Picture Property" Save it again.
**Tip: Create a rectangle same size as image control, add a label that displays No Image Available. Set these to Visible = False. Then, If the the path is null make these controls visible.

On you Subform:
Add this code
Code:
Private Sub Form_Current()
If Not IsNull(Me.ImagePath) Then
    Me.Parent!sfrmImage.Picture = Me![ImagePath]
Else
    Me.Parent![sfrmImage].Picture = ""
End If
End Sub

Private Sub ImagePath_AfterUpdate()
On Error Resume Next
    Me.Parent![sfrmImage].Picture = Me![ImagePath]
End Sub

Here is a link that explains how to handle images in access:

Hope this helps...

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top