Results 1 to 9 of 9
  1. #1
    Lounger
    Join Date
    Jan 2001
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    making jpg files show up

    I am writing a database (Access 2000) that includes a field containing OLE objects. When the object is a bmp (either linked to or embedded in the database), I have no problems - the picture shows in both reports and forms. If the object is a jpg, however, all I can see is an icon (even though I have not checked "show as icon"). The file is there, if I double click the icon my graphics program opens.

    Any suggestions? I can work around this by converting all my files to bmps and linking back to the jpgs, but I'd prefer not to. I can't find any reference to this problem in this forum or in the Knowledgebase, it sounds like other can include jpgs with no problem.

    Thanks.

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: making jpg files show up

    I'm guessing you put the image on your report as an unbound object frame? Trying putting it in as an Image control instead. At least that's the control type in Access97.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Star Lounger
    Join Date
    May 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: making jpg files show up

    I think an image control will not give you what you want. Because you have used an OLE field in the table you would need a bound object frame. An image control will not be able to be linked to the table in Access 97 (at least I can't find a way of binding an image control to a table).

  4. #4
    Giovanni
    Guest

    Re: making jpg files show up

    Apparently no JPG filter is installed on your computer.

  5. #5
    Lounger
    Join Date
    Jan 2001
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: making jpg files show up

    That's what so frustrating - there *is* a jpg filter on the computer in question. I work with jpgs all the time on this machine. Do you know how I can force Access to "recognize" the filter?

  6. #6
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Tennessee
    Posts
    194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: making jpg files show up

    have you tried an image control instead of a bound or unbound object frame

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: making jpg files show up

    I've never been able to make jpgs show up the way you apparently want to. Bitmaps, yes. But jpgs seem to want a browser to display in, so even if you can set the picture property of an unbound frame or an image control, it won't display the way a bitmap will. I suspect you would need to use an ActiveX control to display the jpgs.
    Charlotte

  8. #8
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Tennessee
    Posts
    194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: making jpg files show up

    instead of having an ole field i save the path to the pictures in a table
    and save the pictures in a directory outside of the database
    if you can do this with yours the jpg should work
    they do in my database

  9. #9
    Star Lounger
    Join Date
    May 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: making jpg files show up

    Jerry's right. It works! Here are the steps.

    1. Create a field in your database for the name of the file
    In my case I have just a number eg 101 not even an extension
    2. Open your form in design view
    3. Add an unbound image control to your form
    4. Attach any file to it from your hard disk
    5. Change the picture property of the image to (none)
    You must type in (none) including the brackets
    The picture you attached is now gone and the control is blank
    6. Size the image control to suit your form
    7. Name the image "PhotoPreview" for example
    You can do this by changing the name property in the properties sheet
    7a. Change the Size Mode property of the image to Zoom
    8. Make sure the file name field is on the form as a text control
    It doesn't matter whether this field is visible or not
    9. Add a procedure call to the On Current event of the form
    It should look something like this

    Private Sub Form_Current()
    SetPicturePreview
    End Sub

    10. Add a procedure call to the After Update event of the file name control
    It should look something like this

    Private Sub PhotoNumber_AfterUpdate()
    SetPicturePreview
    End Sub

    11. Save and close the form
    12. Add this code to a module

    '------------------------------------------------------------
    ' Set Picture Preview
    ' This procedure sets the picture property of the unbound
    ' image to the file name of the picture for each record
    '------------------------------------------------------------
    Sub SetPicturePreview()
    On Error GoTo SetPicturePreview_Err

    With CodeContextObject
    .PhotoPreview.Picture = .[PhotoNumber] & ".jpg"
    End With

    SetPicturePreview_Exit:
    Exit Sub

    SetPicturePreview_Err:
    'MsgBox Error$
    Resume SetPicturePreview_Exit

    End Sub




    Now if you want to avoid putting the whole path into the file name field you can
    change the procedure to this:

    '------------------------------------------------------------
    ' Set Picture Preview
    ' This procedure sets the picture property of the unbound
    ' image to the file name of the picture for each record
    ' It finds the path to the picture relative to the path of
    ' the database which it gets from the CurrentDB.Name property
    '------------------------------------------------------------
    Sub SetPicturePreview()
    On Error GoTo SetPicturePreview_Err
    Dim DatabasePath As String

    DatabasePath = CurrentDb.Name
    DatabasePath = Left(DatabasePath, Len(DatabasePath) - 13) & "Photos"

    With CodeContextObject
    .PhotoPreview.Picture = DatabasePath & .[PhotoNumber] & ".jpg"
    End With

    SetPicturePreview_Exit:
    Exit Sub

    SetPicturePreview_Err:
    'MsgBox Error$
    Resume SetPicturePreview_Exit

    End Sub

    I am going to change this because it shouldn't look up the path for
    each record. It should only look up the database path once when the
    database is opened and store it in a table or once when the form is
    opened and store it in an unbound control on the form.

    Hope this helps.

Posting Permissions

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