Solved

Using OLE To Link A Graphic Object

Posted on 2002-07-30
3
368 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access 2016 Debugging 7 43
Run Time Error 3075 15 45
MS Access 03, TransferText, decimal places 8 46
Search Form not Querying 2 11
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now