Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using OLE To Link A Graphic Object

Posted on 2002-07-30
3
Medium Priority
?
409 Views
Last Modified: 2008-03-17
Greetings;

I have an Access database whereby the user selects a file of extension .gif or .jpg listed in an unbound control to be linked to a bound field of type OLE Object (Picture_Image). I am using the following code for the double-click event of the file list (The Picture_File_Name is a bound field which holds the relative path to where the .jpg or .gif file exists):

Private Sub lstFiles_DblClick(Cancel As Integer)
    Dim strFileSelected As String
    Dim strFilePath As String

    strFileSelected = lstFiles.Value
    Picture_File_Name.Value = strFileSelected
    strFilePath = "C:\Documents and Settings\Dave Stolzenbach\My Documents\PBP Clients\Lawrence Technologies\catalog_pictures\" + strFileSelected
    Picture_Image.OLETypeAllowed = 0
    Picture_Image.SourceDoc = strFilePath
    Picture_Image.SourceItem = ???
End Sub

The examples for .SourceItem in Access help and MSDN Library use Excel which isn't helping me much. I need to know what value is expected for .SourceItem for .jpg and .gif files.

Any help on this is greatly appreciated.


Much thanks.

Dave Stolzenbach
Owner
ParkerBach Pages
www.parkerbach.com
1-800-421-1488
Mobile: 1-925-408-6744
Fax: 1-925-825-9450
Email: Dave@ParkerBach.com
Member of the
   Golden Gate Better Business Bureau
   www.GoldenGateBBB.org
0
Comment
Question by:David Bach
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 28

Expert Comment

by:TextReport
ID: 7188555
I do this with an OLEImage rather than an Unbound Object Frame and you just have to specify the Picture property.

The Following code is called from my OnCurrent event

Private Function DisplayImage()
Application.Echo False
DoCmd.Hourglass True
On Error GoTo DisplayImage_error
    If IsNull(Me.txtCalendarPhoto) Then
       Me.oleImage.Picture = ""
    Else
       Me.oleImage.Picture = DEFAULTPATH & Me.txtCalendarPhoto
    End If
   
    If IsNull(Me.txtCalendarPhoto2) Then
       Me.oleImage2.Visible = False
       Me.oleImage2.Picture = ""
       Me.oleImage.Width = Me.oleImage2.Left + Me.oleImage2.Width
    Else
       Me.oleImage2.Visible = True
       Me.oleImage2.Picture = DEFAULTPATH & Me.txtCalendarPhoto2
       Me.oleImage.Width = Me.oleImage2.Width
    End If

DisplayImage_Exit:
    DoCmd.Hourglass False
    Application.Echo True
    Exit Function
   
DisplayImage_error:
    Select Case Err
        Case Else
             MsgBox "An unexpected error hass occourred in DisplayImage" & vbCrLf & vbCrLf & Err & vbTab & Err.Description, vbCritical
             Resume DisplayImage_Exit
    End Select
End Function

Cheers, Andrew
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7286165

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - PAQ'd and pts removed
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
 

Accepted Solution

by:
ComTech earned 0 total points
ID: 7314799
This question will be placed in PAQ and points refunded.

Best regards,
ComTech
Community Support
Administrator @ EE
0

Featured Post

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question