Solved

Using SQL to insert image into MS Access

Posted on 2009-05-05
5
314 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

726 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