By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,510 Members | 1,815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,510 IT Pros & Developers. It's quick & easy.

Storing a JPEG within a database

NeoPa
Expert Mod 15k+
P: 31,476
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.
Oct 25 '06 #1
Share this Question
Share on Google+
12 Replies


100+
P: 143

NeoPa
Expert Mod 15k+
P: 31,476
This might help.

http://support.microsoft.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 :-(.
Oct 25 '06 #3

Expert 5K+
P: 8,434
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.
Oct 25 '06 #4

NeoPa
Expert Mod 15k+
P: 31,476
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.
Oct 25 '06 #5

MMcCarthy
Expert Mod 10K+
P: 14,534
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 ...
Oct 25 '06 #6

MMcCarthy
Expert Mod 10K+
P: 14,534
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.



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 ...
Oct 25 '06 #7

NeoPa
Expert Mod 15k+
P: 31,476
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.
Oct 26 '06 #8

MMcCarthy
Expert Mod 10K+
P: 14,534
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.
Oct 26 '06 #9

NeoPa
Expert Mod 15k+
P: 31,476
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.
Oct 26 '06 #10

NeoPa
Expert Mod 15k+
P: 31,476
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 :-)
Oct 26 '06 #11

MMcCarthy
Expert Mod 10K+
P: 14,534
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.
Oct 26 '06 #12

NeoPa
Expert Mod 15k+
P: 31,476
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.
Oct 26 '06 #13

Post your reply

Sign in to post your reply or Sign up for a free account.