Storing a JPEG within a database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32668

    Storing a JPEG within a database

    Since some of you guys know so much about different areas of Access, I'll ask a question I'd previously given up on.
    I have a company logo which is currently stored as a .Jpg file on the network.
    I show it on reports by including an 'Image' type field in the reports which links to the name of the file.
    My question is :-

    How can I store this in a table in an Access database such that it doesn't have to load it from the file every time it is accessed?

    I need to know :
    1. How to define the field where it is stored.
    2. How to use it in a report.

    I suspect that this may be something that's been done before but I got stuck when I tried it.
  • Tanis
    New Member
    • Mar 2006
    • 143

    #2
    This might help.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32668

      #3
      Originally posted by Tanis
      This might help.

      http://support.microso ft.com/kb/198463/en-us
      Thanks Tanis.

      I checked out the link but it pretty well describes my current position.
      What I'm trying to get to, is to store the image within the database and therefore avoid the delay of loading the image into memory every time I run any report.
      Maybe it's just not supported & I will have to leave it as it is :-(.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by NeoPa
        Thanks Tanis.

        I checked out the link but it pretty well describes my current position.
        What I'm trying to get to, is to store the image within the database and therefore avoid the delay of loading the image into memory every time I run any report.
        Maybe it's just not supported & I will have to leave it as it is :-(.
        If there is a noticeable delay, perhaps your image file is larger than necessary. Are you taking a large image and resizing it to display? If so, you might save time by saving a small copy and using that.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32668

          #5
          That's a good idea Killer - but I have already implemented that.
          The delay is usually between 3 and 10 seconds, so not a mega-problem in itself.

          My main problem is that I don't like things done imperfectly.
          To my mind the 'correct' way to implement this is stored in a table in my database. It's like a burr in my side :-(.
          In truth, I can live without this, but the answer would certainly make me happier.

          It goes without saying that I appreciate all attempts at help, whether or not they are the 'ultimate answer'. So thanks guys.

          Comment

          • MMcCarthy
            Recognized Expert MVP
            • Aug 2006
            • 14387

            #6
            So you noticed I'm still up. I'm supposed to be working. Ha Ha

            Anyway to store a file of any time in the database, image or otherwise, you need to create an ole object type field. You can then store the file there as a linked or embedded file.
            Hope this helps ...

            Comment

            • MMcCarthy
              Recognized Expert MVP
              • Aug 2006
              • 14387

              #7
              By the way I should mention you can't attach this type of file to an image frame you will have to use a bound or unbound object frame.



              Originally posted by mmccarthy
              So you noticed I'm still up. I'm supposed to be working. Ha Ha

              Anyway to store a file of any time in the database, image or otherwise, you need to create an ole object type field. You can then store the file there as a linked or embedded file.
              Hope this helps ...

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32668

                #8
                I noticed easily because you sneaked in a post before mine again :-( - in Killer's thread - lol.
                Anyway, thanks for the input, I'll see if I can make it work for me tomorrow at work. It's not an area of great familiarity for me so I'll have to take it simple steps at a time.

                Oh look number 4 on the leader board - Xlnt.

                Comment

                • MMcCarthy
                  Recognized Expert MVP
                  • Aug 2006
                  • 14387

                  #9
                  Originally posted by NeoPa
                  I noticed easily because you sneaked in a post before mine again :-( - in Killer's thread - lol.
                  Anyway, thanks for the input, I'll see if I can make it work for me tomorrow at work. It's not an area of great familiarity for me so I'll have to take it simple steps at a time.

                  Oh look number 4 on the leader board - Xlnt.
                  Keep going the way you're going and you'll soon be fighting me for top spots. I wasn't as prolific as usual today as I had to get some work done so any time you want to jump in you're more than welcome. I don't want to leave queries orphaned without any response if possible.

                  Talk to you soon.

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32668

                    #10
                    I look forward to that.
                    I'll do what I can in these forums - I can't promise too much as time is an issue but I'll do what I can.

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32668

                      #11
                      That worked perfectly.
                      Thanks for that MMcCarthy.

                      Now I've just got to copy and paste my new Unbound Object field into the other 66 reports in my main DB - I'll get on to the other DBs when that one's all done.

                      I've now had two long term problems solved on these forums so I'm quite impressed.
                      I'll come here again :-)

                      Comment

                      • MMcCarthy
                        Recognized Expert MVP
                        • Aug 2006
                        • 14387

                        #12
                        Originally posted by NeoPa
                        That worked perfectly.
                        Thanks for that MMcCarthy.

                        Now I've just got to copy and paste my new Unbound Object field into the other 66 reports in my main DB - I'll get on to the other DBs when that one's all done.

                        I've now had two long term problems solved on these forums so I'm quite impressed.
                        I'll come here again :-)
                        Why not just create a table with OleID Number field and OleObject Text Field. Just store the one record and it will give you the opportunity to add later.

                        Then you just have to add a number field to other tables 'OleID' as foreign key to this table. It will reduce size considerably as object only linked once. You can also default this field to value in OleID.

                        Comment

                        • NeoPa
                          Recognized Expert Moderator MVP
                          • Oct 2006
                          • 32668

                          #13
                          I did think of something along those lines M, but that would actually involve more updating than what I've done (already finished now) in my case. Also, I use some queries for output to Reports as well as to other destinations so wouldn't want it in the query.
                          I'm happy with a DLookUp() within my Unbound Object field included in all my reports.
                          The object is stored only once in a control table with just the 1 record so performance is swift.
                          All-in-all overheads much reduced and thanks for all your help.

                          Comment

                          Working...