Solved

Using OLE To Link A Graphic Object

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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