Displaying an image conditional on an Access Report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sierra7
    Recognized Expert Contributor
    • Sep 2007
    • 446

    #31
    Corey,
    I missed that you said the images were stored as ATTACHMENTS. I think our posts crossed.

    I'll try that shortly and 'report back'!
    S7

    Comment

    • Corey Smith
      New Member
      • Nov 2011
      • 15

      #32
      I don't have an issue attaching the database for you guys to look at.

      But first, over the last night I was thinking that maybe our approach to accessing the images is what is giving the headaches. Right now we have a separate table linked in that has the category code and the images are stored in an attachment field ... which for whatever reason, we cannot figure out how to check whether it is empty or not using VBA code.

      Would the better approach be for us to go the route where we store the paths to where the images are in a text field? Then just check whether that text field is empty, or not?

      In other words, if you guys were setting this up ... what approach would you take?

      Thanks again for all the help.

      Comment

      • sierra7
        Recognized Expert Contributor
        • Sep 2007
        • 446

        #33
        Hi again
        Now that I have added the image as an ATTACHMENT my modified test-bed reports that there is an image present for every record (i.e. the control content is not evaluation to Null) even though there is only an image attached to one.

        IsEmpty() did not work either. At least this is now consistant with Corey's findings so are on the same song-sheet as it were.

        I want to try a few more things yet

        S7

        Comment

        • sierra7
          Recognized Expert Contributor
          • Sep 2007
          • 446

          #34
          Some success!

          You can test the AttachmentCount property to see is an image is attached.

          Code:
          If Me.P2.AttachmentCount = 0 Then
              MsgBox "Image is blank"
              Me.P2.Height = 0
          Else
              MsgBox "Image is present"
              Me.P2.Height = 5 * 567
          End If
          It seems that you can add multiple attachements to one record.

          Interestingly the CurrentAttachme nt property seems to return zero whether or not a file is attached (possibly because the control did not have focus)

          MSDN details the Attachument properties herehttp://msdn.microsoft.com/en-us/libr...ffice.12).aspx

          Corey, in answer to your question "How would you guys do it?", last time I think I embedded the path to the external image, in the image control. The object was always to keep the images outside the database.

          I think I have read about Access-2010 being able to store Binary Large Objects (BLOB's) efficiently but I could not find any references when I looked the other night. When I built the test system I ended up using OLE objects bnecause I could not find BLOBs. When I first used OLE (15 yrs ago) it was VERY inefficient, I was told because it embedded bits of the executable required to interprete the linked object. I don't know if is still true (or ever was)

          S7

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32634

            #35
            I would go along with S7's thinking. Storage space is at less of a premium nowadays, but Access databases still have a 2GB limit last I heard. I expect there is still a performance hit with linked images, but the space reduction is quite heavy too. The only real way to tell what suits you best is to suck it and see. I would expect the issues to be performance and size though.

            Comment

            Working...