A picture is worth a thousand words, but takes up considerably more storage space
Using code
Instead of using an OLE Object field, you can use a text field. In that you
store, not the image, but the text version of the path to the image (as
mentioned on page one).
You can then use VB code to control the recall of the image and the way in which it is displayed. This is very economical because, no matter how large the image, all you store is a text string.
In addition, if you move the files to another computer, even if you store the images in a different folder, all you have to run is an update query on the text field to update the pointers to the new location. The bad news (depending on your current level of expertise) is that you need to use code.
Buy extra functionality
You can buy a specialised add-on for the database which provides additional
functionality for images.
One such is DBPix from Ammara. I have to admit that I haven’t tried it myself
but it seems to be highly recommended and you can
download
a fully functional evaluation version free.
I have to say that, overall, I am not entirely impressed with Access’ ability with images. For example the support for .JPG files is poor. Even though it will store them, you cannot display them in a form; at least, not by default.
Having said that, the process of storing and retrieving them is easy, so let’s take a look at this in practice.
Getting practical
Create a table and add a field with the OLE Object data type (all of this is
done for you in DBCJAN08.MDB). If you’ve bought the DVD edition of PCW, you’ll
find this database on the cover disc. It is also on the web at
www.pcw.co.uk/2151344. You’ll notice that there are few properties that you can
set for the field).
Then, using the autoform button, create a default form based on the table. Rather oddly, you have more control over the properties of the image here than you do in the table.
If you right-click on the control you’ll find you can set properties such as OLE Type Allowed. Now right-click on the image control, select ‘Insert Object’ and choose the ‘Create from File’ radio button. From here you can select whether to embed the image or link to it. You can also navigate to the image file of your choice.
No matter whether you embed or link them, JPEG files do not appear in the control. However if you double click on the control an application opens up which contains the image. BMP files, on the other hand are kind enough to appear in the box.
This method of adding images files is a little tedious but you can also drag and drop image files onto the control, which is much, much faster.
So, I may carp about the support for JPEGs but, as you can see, working with images has been made pretty easy in Access.
Article tags
Related articles
Q.Why are some of the keys on my keyboard doing strange...
Q.Is my phone’s Bluetooth any use?
Q.Can I switch boot drives so that I can work on older...
Old Street roundabout is being touted by the Government as the UK's answer to Silicon Valley, but it seems our best innovations are coming from all over the UK
|
|
|
|
|
Computeractive Excel (2010) Online tutorialPrice: £19.99 |
Computeractive Word (2010) Online TutorialPrice: £19.99 |
Computeractive Powerpoint (2010) Online TutorialPrice: £19.99 |
Angry BirdsPrice: £9.99 |
Back Issue CD-Rom 14 (2011)Price: £15.99 |