Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2003
    Posts
    2

    Unanswered: Entering data in an OLE field and converting to pictures

    I am working in Access 2002 and trying to add a picture to my form. In tables, I use the insert object function to try and insert a .bmp file. All I get is the word Package instead of the file itself. What am I doing wrong? Please help me!

  2. #2
    Join Date
    Sep 2002
    Location
    Land of OZ
    Posts
    173

    Re: Entering data in an OLE field and converting to pictures

    Originally posted by andersonbg
    I am working in Access 2002 and trying to add a picture to my form. In tables, I use the insert object function to try and insert a .bmp file. All I get is the word Package instead of the file itself. What am I doing wrong? Please help me!
    Hi andersonbg,

    During your insert stage, in the insert dialog box the option to "display as Icon" as been checked. Make sure that it is unchecked, and this will display the image instead of a Word icon.

    Hope that this helps
    Mona
    ________________________________
    Life is too short to be sane or sensible. Weird people rule and normal people suck

  3. #3
    Join Date
    Jul 2003
    Posts
    2

    Re: Entering data in an OLE field and converting to pictures

    Thanks Mona. The Display as Icon box is unchecked and I continue to get the word "package." I'm trying to insert either a .jpeg or .bmp file into a table.

    Brenda

    Originally posted by mona
    Hi andersonbg,

    During your insert stage, in the insert dialog box the option to "display as Icon" as been checked. Make sure that it is unchecked, and this will display the image instead of a Word icon.

    Hope that this helps

  4. #4
    Join Date
    Sep 2002
    Location
    california
    Posts
    31

    Question similar problem with pictures

    I have a 2002 Access database with a table that has an OLE field for a picture that will show on a form and report. When I insert the picture (jpg) the picture shows up on the form and the report just fine....NOW here is the problem...I put the database on another computer and when the user inserts tje same picture the form and report don't show the actual picture they show the file name of the picture (not the path, just the file name, ie photo.jpg)....I've search various forums and this thread is the closet I've found, but still don't have an answer. I was actually at the site last week and tried the user's computer and it did the same thing to me.

    Does anyone have any idea what might be going on here???? The user really wants the pictures showing up on the reports.

    Thanks for you time and attention.
    Debbie

  5. #5
    Join Date
    Aug 2006
    Location
    Near Houston, Tx
    Posts
    1

    Unhappy Photos in MSAccess

    Having same problem as Debbie. Whether the show as ICON is checked or not. Have looked at all of the options and various check boxes, various field formats. etc. Photos will not show on screen except as an icon.

  6. #6
    Join Date
    Sep 2002
    Location
    california
    Posts
    31
    Won't show up on screen or in report when I try to print them. HELP!!!!

  7. #7
    Join Date
    Sep 2006
    Posts
    1
    Quote Originally Posted by debbie5154
    I have a 2002 Access database with a table that has an OLE field for a picture that will show on a form and report. When I insert the picture (jpg) the picture shows up on the form and the report just fine....NOW here is the problem...I put the database on another computer and when the user inserts tje same picture the form and report don't show the actual picture they show the file name of the picture (not the path, just the file name, ie photo.jpg)....I've search various forums and this thread is the closet I've found, but still don't have an answer. I was actually at the site last week and tried the user's computer and it did the same thing to me.

    Does anyone have any idea what might be going on here???? The user really wants the pictures showing up on the reports.

    Thanks for you time and attention.
    Debbie
    Debbie,

    You are probably experiencing a problem with the software currently installed on your computer that is not installed on your client's computer. We had an issue similar to this where one of our users was able to import a jpeg image onto a bound ole control, and it would display as the image for all of our users. However, when some of the other users tried to do the same thing, it showed up as an icon for everyone.. And in some cases, just a file name.

    I have 2 suggestions for you. One of these may be easier than the other, depending on your coding ability.

    1) Figure out which software is causing the image to display properly, and install that software on your client's machine. You can find this out by right-clicking on the ole object. A context menu will popup, showing you a list of options. Underneath the 'Insert Object...' option, on the working computer, it should tell you a specific object type. (In our case, it was Microsoft Photo Editor) On your client's computer, it will just say 'Package Object'. For your client to be able to import the image to the ole object, they will need that software installed on their system.

    If your software is Microsoft Photo Editor, then you may have issues when trying to add images other than JPGs.. I did a work-around for this for my clients, which you'll see in option #2.

    2) Delete the object frame from your form/report, and add an Image control instead. On the form's current event, check to see if there is data in your ole field, and then set that image's ImageName.PictureData to be equal to what is in the ole field of the table. For example:
    Code:
    ImageControlName.PictureData = me![OLEDataFieldName]
    To import the images into the table for this method, you will need to have a button, or a double-click event on the image.. or something, so you can ask the user for a filename. You can then use API to have the Common Dialog box open up so they can browse for the image they would like to add.

    Now... Here's how I go about storing the image data in the table:
    Code:
    Private Sub MyButton_Click()
      Dim FileName As String
    
      'Call up the common dialog box to get the file name.
      FileName = cdlgGetFile(Me.hwnd)
    
      'If we cancelled, FileName will not have any data in it, so exit.
      If Len(FileName) = 0 Then Exit Sub
    
      'Set the picture of the image control to that of the image in the file selected.
      'This will cause the image control to automatically load the image.
      ImageControlName.Picture = FileName
    
      'Set the OLE field in the table to the current image stored in the Image control.
      Me![OLEDataFieldName] = ImageControlName.PictureData
    End Sub
    I have to allow importing files in multiple forms, so I created a public module to store the cdlgGetFile function. Here is the code I used for that:
    Code:
    Option Compare Database
    Option Explicit
    Public Declare Function GetOpenFileNameA Lib "comdlg32.dll" (pOpenfilename As OPENFILENAME) As Long
    Private Type OPENFILENAME
      lStructSize As Long
      hwndOwner As Long
      hInstance As Long
      lpstrFilter As String
      lpstrCustomFilter As String
      nMaxCustFilter As Long
      nFilterIndex As Long
      lpstrFile As String
      nMaxFile As Long
      lpstrFileTitle As String
      nMaxFileTitle As Long
      lpstrInitialDir As String
      lpstrTitle As String
      flags As Long
      nFileOffset As Integer
      nFileExtension As Integer
      lpstrDefExt As String
      lCustData As Long
      lpfnHook As Long
      lpTemplateName As String
    End Type
    Function cdlgGetFile(hwnd) As String
      Dim OpenFile As OPENFILENAME
      Dim lReturn As Long
      Dim sFilter As String
      
      With OpenFile
        .lStructSize = Len(OpenFile)
        .hwndOwner = hwnd
      
        sFilter = "All Files (*.*)" & Chr(0) & "*.*" & Chr(0) & _
                  "JPEG Files (*.JPG, *.JPEG)" & Chr(0) & "*.JPG;*.JPEG" & Chr(0) & _
                  "Bitmap Files (*.BMP)" & Chr(0) & "*.BMP" & Chr(0)
        .lpstrFilter = sFilter
        .nFilterIndex = 1
        .lpstrFile = String(257, 0)
        .nMaxFile = Len(OpenFile.lpstrFile) - 1
        .lpstrFileTitle = OpenFile.lpstrFile
        .nMaxFileTitle = OpenFile.nMaxFile
        .lpstrInitialDir = ""
        .lpstrTitle = "Select Image To Import"
        .flags = 0
      End With
      
      lReturn = GetOpenFileNameA(OpenFile)
      If lReturn <> 0 Then
        cdlgGetFile = Trim(Left(OpenFile.lpstrFile, InStr(1, OpenFile.lpstrFile, vbNullChar) - 1))
       End If
    End Function
    Now.. If you already have a number of images stored in your table, then you probably want to go with the 1st option.. I just so happened to be working on a fairly new database, and the OLE images are an added feature, so I was able to fiddle around and come up with option #2.

    I hope everything works out for you.

    Verrigan
    Agora Information Design

    [edit]
    I have to say I am unsure of what the results of option #2 would be in a report.
    Last edited by Verrigan; 09-06-06 at 21:51.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •