?
Solved

Using SQL to insert image into MS Access

Posted on 2009-05-05
5
Medium Priority
?
320 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 2000 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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…
Suggested Courses

771 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