Adding staff photographs to my database

K

KK

Hello,

I am building a database of staff details, names, addresses etc.. I would
like to add a photo for each of them. I have the photos as jpegs. I have set
up a field 'photo' in the database and I've tried to copy & paste the jpg
file to it, but am getting an error message about opening the OLE
application?

Is there a simple way of doing this please?

Thanks

KK
 
R

Raghu Prakash

Hi KK,

Store pictures and photos in a database

You can display images, such as pictures, logos, and photographs, on your
forms, reports, and data access pages (data access page: A Web page,
published from Access, that has a connection to a database. In a data
access page, you can view, add to, edit, and manipulate the data stored in
the database. A page can also include data from other sources, such as
Excel.). You can display static images, such as logos and banners that do
not change from record to record, or display a different image for each
record in the form or report. For example, the online Products Catalog
might display the picture corresponding to the product that is currently
being viewed.

For more information on how to display images on forms, reports, and pages,
see the following Office Online article:

Dress up your Access database, at
http://office.microsoft.com/assistance/preview.aspx?AssetID=HA010822771033.
This article focuses on how and where to store the images so that you can
display them on forms and reports. You can store images in one of the
following ways:

Store images in the database You store the images in an OLE Object field
in a table. You can then add an image control on a form or report to
display the contents of this field for each record. Note that this
technique does not work for data access pages.

Create an OLE object field in a table to store images

Open the table in Design view.
Add a field, and set the data type to OLE Object in an Access database, or
to Image in an Access project. For more information on how to add a field
to a table, see the Help topic Add a field to a table.
In Datasheet view, right-click the OLE Object field in the row for which
you want to add a picture, and click Insert Object.
In the Microsoft Office Access dialog box, select Create New if the image
file does not exist, or Create from File if the file already exists.
Create New Select the Object Type, and click OK. Depending on the object
type you chose, you will be able to create the image and save it as a file.

Create from File Select the file that contains the image you want to
store in the database, and click OK. Select the Link check box if you want
to maintain a link to the file, instead of embedding the contents of the
file in the database.

Note Select Display as Icon to display an icon that represents the object
type in Datasheet view.

Note On a form, a bound frame control can be bound to an OLE object field,
and you can add images through this control to the underlying field in Form
view. For more information on how to add images to an OLE object field in
Datasheet view or to a bound frame control that is bound to an OLE object
field in Form view, see the section Add a picture or object that changes
from record to record in the Help topic Add a picture or object.

Store the paths to the image files in the database Instead of storing the
pictures in the database, you could store just the path to the pictures. If
you use this technique for a form or report, you need to write a Microsoft
Visual Basic® for Applications (VBA) procedure to read the path information
and display the pictures when the user opens the form or report. On a data
access page, you add an image control and then bind it to a text field that
contains the path to the pictures.

Create a text field in a table to store paths to image files

Create a field in a table and set the field's data type to Text in a
Microsoft Access database (Microsoft Access database: A collection of data
and objects (such as tables, queries, or forms) that is related to a
particular topic or purpose. The Microsoft Jet database engine manages the
data.) or varchar in a Microsoft Access project (Microsoft Access project:
An Access file that connects to a Microsoft SQL Server database and is used
to create client/server applications. A project file doesn't contain any
data or data-definition-based objects such as tables and views.).
In Datasheet view (Datasheet view: A window that displays data from a
table, form, query, view, or stored procedure in a row-and-column format.
In Datasheet view, you can edit fields, add and delete data, and search for
data.), type the path to the image (a .bmp, .jpeg (JPEG: A graphics file
format (.jpg extension in Microsoft Windows) supported by many Web browsers
that was developed for compressing and storing photographic images. It's
best used for graphics with many colors, such as scanned photos.), .gif
(GIF: A graphics file format (.gif extension in Windows) used to display
indexed-color graphics on the World Wide Web. It supports up to 256 colors
and uses lossless compression, meaning that no image data is lost when the
file is compressed.), .dib, .wmf, or .emf file) in the field you created.
If you will be sharing the Access database, you might need to specify a UNC
path (universal naming convention (UNC): A naming convention for files that
provides a machine-independent means of locating the file. Rather than
specifying a drive letter and path, a UNC name uses the syntax
\\server\share\path\filename.).

If you will be displaying the pictures on a data access page, you might
need to specify a URL (Uniform Resource Locator (URL): An address that
specifies a protocol (such as HTTP or FTP) and a location of an object,
document, World Wide Web page, or other destination on the Internet or an
intranet, for example: http://www.microsoft.com/.) to a valid Web address.

Caution Users of your database or data access page will be able to view
the image paths. You might want to make sure that the paths do not include
personal information, such as your name or the name of your computer.

Tip

You can use relative paths to store pictures. For example, if the Access
file (Microsoft Access file: An Access database or Access project file. An
Access database stores database objects and data in an .mdb file. A project
file doesn't contain data and is used to connect to a Microsoft SQL Server
database.) is located at \\ServerName\ShareName\ and the pictures are
stored in the folder \\ServerName\ShareName\Pictures, you don't have to
specify the entire path, such as
\\ServerName\ShareName\Pictures\PictureFileName.gif, for a picture that you
will display in a form or report. You only need to store the portion of the
path that is different relative to the location of the current Access file—
Pictures\PictureFileName.

If you want to use relative paths to store the locations of pictures that
you will display in data access pages, those paths must be relative to the
location of the data access page, not the location of the Access database
or Access project.


For Further Information:
http://office.microsoft.com/en-us/assistance/HP052802251033.aspx

Please let me know has this helped You...
Thank you...
Raghu...
This posting is provided "AS IS" with no warranties, and confers no rights.
 
E

Exponent

Here are 3 possible approaches with comments:

1) OLE Embedding/Linking. Potentially huge overhead for JPEG (up to 200 *times*). MS have ceased supplying
OLE servers for images in Office. Very common cause of configuration problems. Loss of metadata & compression.
Not recommended.

2) Blob/raw binary. No overhead, no external files to manage. This can be coded in VBA, but this way
is rather complex and still relies on external viewers/filters.
Alternatively can be implemented with zero code by using 3rd party controls.

3) External image files. Slightly simpler to code in VBA than the above, but needs care to ensure that
files are not accidentally orphaned/overwritten/deleted by users. Also relies on external viewers/filters
which may need installing on users' systems.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top