Solved

Using SQL to insert image into MS Access

Posted on 2009-05-05
5
268 Views
Last Modified: 2012-05-06
How do I write the SQL to insert an image into an OLE object in Access?

This is on a web server.

Let's assume the image is in "tempwork/abc.jpg".

Is it like this:
x = "tempwork/abc.jpg".
INSERT into table (oleimage) values('" &  x & "')"

0
Comment
Question by:Richard Korts
5 Comments
 
LVL 25

Accepted Solution

by:
reb73 earned 500 total points
ID: 24308468
It may be inadvisable to store images in an MS-Access database as you may have problems with bloating in terms of mdb filesize over time..

But if you want to go ahead and do so, it may not be possible to do it with pure SQL code.. Have a look at the link below which has code example using getchunk/appendchunk -

http://acmesoffware.com/acme/ExamplesVBA/vbaExm_appendchunkimages.asp
0
 
LVL 11

Expert Comment

by:Goodangel Matope
ID: 24310998
It is not possible to use just SQL to insert the image. You will need to use VBA, or other programming language like Visual Studio / Delphi to do this.
0
 

Author Comment

by:Richard Korts
ID: 24311010
To all:

I am using VBscript on a web server. Can it be done using that?

Thanks
0
 
LVL 25

Expert Comment

by:reb73
ID: 24312066
The link provided in my previous post (http:a24308468) has VBA code which you should be able to adapt to VBScript...
0
 

Expert Comment

by:mmiski
ID: 24314897
I've inserted images using access,  If I remember right I had to copy then paste the image for each record to be able to save the image, but size of the database will grow quite fast and after a few hundred images you will see performance issues.  The best practice would be to simply save the image in a predefined folder then use a text field and save the path to the image and then using VBA or VB script to display the image where the path is located.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now