Solved

Using SQL to insert image into MS Access

Posted on 2009-05-05
5
290 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 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