As we all know, Microsoft Access allows users to store images directly in their database. This feature is ideal for applications requiring product photos, employee IDs, or client files. You can store pictures in a table using specific data types like OLE Object or Attachment. It also makes your data visually appealing and easier to understand. Well, in this blog, I will show you how to insert image in Access database quickly and efficiently.
Free MS Access Database Repair Tool
Repair corrupt MDB and ACCDB database files and recover deleted database tables, queries, indexes and records easily. Try Now!
By clicking the button above and installing Stellar Repair for Access (14.8 MB), I acknowledge that I have read and agree to the End User License Agreement and Privacy Policy of this site.
Can Microsoft Access Store Images?
Yes, you can store images in your Access database. Well, this task is possible by using attachments that store multiple types of files in a single field.
Suppose you have made a job contact database. By using the attachments, you can attach one or more resumes for each contact’s record, and can also insert a photo of the contact.
Previous versions of the MS Access database make use of a technology known as Object Linking and Embedding (OLE) for storing documents and images. By default, for each image and document, OLE generates a bitmap.
These bitmap files are quite large in size. 10 times greater than the original file. When a user views their image and document from their database, OLE displays only the bitmap, not the original one. Apart from that, OLE needs programs known as OLE servers to work.
In contrast, MS Access attachments store the attached file in its native format. So, you don’t need to install any additional software to see images in your database.
What Are Techniques To Handle Image In Access Database?
This is one of the most commonly asked questions regarding the insertion of images in the Access database. Well, there are many ways or techniques to add images in the Access database. so, let’s discuss them one by one.
- In the OLE field store the image you want to insert. After then for the image display just make use of the bound object frame.
- Store image path in the text field and to show the image make use of image control.
- Another way is to store the picture in Binary Large object bitmap (BLOB) within an OLE field. Whenever you need just extract the picture you want and make use of image control for an easy view of the image.
All the techniques mentioned here to insert picture in Access database has some advantages & disadvantages too. So, let’s discuss them in brief.
Also Read: How To Import Outlook Email Into Access Database?
How To Insert Image In Access Database Through Attachments?
For using attachments in your Access database, you need to first add an attachment field in at least a single table of your database. MS Access provides two ways to add such attachment fields within your database table. You can either add attachment fields in the Datasheet view or in the Design view. Here we are trying this with the Datasheet view.
Add an attachment field in Datasheet view
- Open your Access database table in Datasheet view, and tap to the first available blank column. It’s not that tough to fetch a blank column, just look for the words “Add New Field” on the column header.
- Now on the Datasheet tab, within the Data Type & Formatting group, tap the down arrow present next to Data Type. After then tap to the Attachment
For the attachment field Access will set the data type. Also, place one icon in the field’s header row. The shown figure is of the new Attachment field. You can see an icon of a paper clip in the header row of the field. You are not allowed to put text in the attachment field’s header row.
- It’s time to save all the changes you have done.
Note:
You are not allowed to convert any new field into another data type. but if any error takes place then you can delete the field.
Add An Attachment To A Table
- In the table having your attachment field opened in datasheet view. Make a double tap on the attachment field.
This will open the Attachments dialog box as shown in the below figure:
- Now click on the Add button, this will open the Choose File dialog box.
- Make use of the Look in list to browse for the file/files which you need to insert in your record. After making a selection for the file tap the Open option.
- Now in the Attachments dialog box, tap the OK option for adding the files with your table.
Access adds files with the field and increases the number of attachments according to that. The below-shown figure shows the field with two attached images:
- Repeat the same step whenever you need to add files to the current field or any other fields of the Access table.
How To Insert Image In Access Using OLE Object Fields?
OLE object is one such data type that helps you to easily save files generated by some other programs like Excel spreadsheets, Word documents, or graphics. This section gives you an idea of how to work with the OLE object fields.
Steps To Insert Image In Access Using OLE Object Fields
Here we are using a table name tblEmployees and a form name frmEmployees, which is previously made.
- Choose the table tblEmployees after that tap to the Design button.
Now insert the OLE field into this tblEmployees table.
- Tap to the firstly found blank Field Name row after then type text “Photo”. Hit on the arrow list containing the Data Type. Then from the list of data types, choose the OLE Object.
Great job, your OLE Object field is created now..!
- Now save all the changes. To view the table in the datasheet view hit on the View button from the toolbar.
Now we are adding some OLE objects into the record of Maria Wyatt.
- Tap to any of the fields for selecting Maria Wyatt after then scroll on the right section. Tap to the Photo field to get into the Maria Wyatt record, and choose the Insert Object option from the menu.
This will open the dialog box of “Insert Object” dialog box on your screen.
For creating and inserting any new object, select the option “Create New”. Other than this, just a click on “Create from File” option for inserting an already existing file.
- Here we have chosen the option “Create from File”. So, after choosing it you need to assign name and the destination of the file that you require to insert.
- Now tap the Browse option. After pressing on this option, make a selection for the image file that you need to insert into your document.
- Once you get it, make a double-click on it eg, Maria.bmp file.
On the side of the “browse” button, you can see a “Link” checkbox. This checkbox is for determining whether this OLE object, merely linked with the Access database or actually embedded into the database.
Here we leave this link box unchecked, as we desire to embed graphics within the database.
- After completing the procedure, tap on the OK option. This will close the open dialog box and access will embed the Maria.bmp picture within the Photo field.
But the problem that occurs with these OLE object fields, is that it won’t show the native OLE objects. That’s the reason why you need to make use of the form with the OLE object fields to work smoothly.
- Now close the table name tblEmployees. Tap to Forms icon present in Objects bar. Hit frmEmployees form, After then tap to Design option.
Now you need to add a new photo field into your frmEmployees form.
- After then tap to button Field List present on the toolbar. You can select & drag down the Photo field at any place on your Access database form.
Other than this, you can display the field list to choose view>>Field List present on the menu.
You don’t have to worry about the position for placing the OLE object Photo field. As, by using any form of control, users can easily resize and move OLE object fields.
Let’s check it out how this Photo field appears in the Form view.
- Hit View option on toolbar for making the switch to the Form view. Tap to Next Record Navigation option until and unless you get Maria’s record.
Yeh, great work here is your inserted image!
How To Insert Image In Access By VBA code?
In your Access database make a Memo field for storing the Image. use the following code to insert image into the Access database using VBA code:
Dim FN As Long
Dim FBFN = FreeFile
Open “C:\Pict1.bmp” For Binary Access Read As FN
FileBinary = Space(LOF(FN))
Get #FN, , FB
Close #FN‘Open RecordSet RS
rs.AddNew
rs(“ImgName”) = “Picture1”
rs(“ImgMem”) = FB
rs.Update
To retrieving image file From Access:
Dim MPict
Dim FN As Long
‘Place an Image Control(Image1) on the Form
‘Open Recordset RS hereMPict = RS(“ImgMem”)
If Dir(“C:\Temp.bmp”) <> “” Then
Kill “C:\Temp.bmp”
End IfFN = FreeFile
Open “C:\Temp.bmp” For Binary Access Write As #FN
Put #FN, , MPict
Close #FNImage1.Picture = LoadPicture(“C:\Temp.bmp”)
Insert Picture into MS Access/SQL table using Java
You can also insert picture into MS Access/SQL table using the Java program. For this, you need to make a table in your Access database. Do it as shown below:
Table Definitions:
Column Definition:
Table Description:
|
After creating the table now it’s time to create the DSN. Make use of the following source code of InsertPicture.java.
*/
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class InsertPicture
{
public static void main(String[] args) throws Exception, IOException
{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
String url=”jdbc:odbc:MyDsn”;
Connection conn=DriverManager.getConnection(url);
String INSERT_PICTURE = “insert into Img(ID,Image) values (?, ?)”;
FileInputStream fis = null;
PreparedStatement ps = null;
try
{
conn.setAutoCommit(false);
File file = new File(“laura.jpg”);
fis = new FileInputStream(file);
ps = conn.prepareStatement(INSERT_PICTURE);
ps.setString(1, “001”);
ps.setBinaryStream(2, fis, (int) file.length());
ps.executeUpdate();
conn.commit();
}
finally
{
ps.close();
fis.close();
}
}
}
After then compile the above code by using the javac compiler. At the end run the program.
C:\jdk1.4\bin javac InsertPicture.java
C:\jdk1.4\bin java InsertPicture
Now you will see the above code works great to insert a “laura.jpg” named picture within the image table.
Problems Associated With Image Insertion In Access Database
Sometimes, it’s not that easy to insert images into the Microsoft Access table. If you are inserting several images or each of the image files is quite large in size, then it automatically raises the “Access Database Too Large” Issue. Well, to resolve this issue, just make use of Access’ built-in utility tool, compact and repair. Otherwise, very soon your database will get corrupt.
Unluckily, if you are already dealing with this Access database corruption issue. Then to get back your crucial data back make use of an outstanding Access Repair And Recovery Tool. It is the most prominent solution available to fix any corruption issue that occurred in Access database file ACCDB and MDB.
Related FAQs:
Which Data Type Is Used to Insert an Image in an Access Table?
Pictures, videos, sounds, and other binary objects (BLOBs) can be saved in OLE objects (Binary Large Objects) data type.
What Data Type Is an Image in Database?
The composite data type is an image in an Access database.
How Do I Insert an Image in Access Database?
To insert an image in an Access database, follow the steps below:
- With the DB table that holds your attachment field open in the Datasheet view, double-click the attachment field.
- After this, click Add.
- Use the Look in list to navigate to the file(s) that you need to attach to a record, select the file(s) >> then click Open.
Which Option Is Used to Insert Image?
All you need to do is go to the Insert tab, then click Pictures. Browse your document where you need to insert a picture.
Time to Say Goodbye!
So, this is all about how to insert image in Access database.
Inserting photos into an Access database is straightforward. With the help of the right setup mentioned above, it becomes a quick & easy task. Whether you use OLE Objects or Attachment Fields, pictures can significantly enhance your database’s value.
Stay organized, optimize your images, and enjoy a better-looking, more functional database!

This software repairs & restores all ACCDB/MDB objects including tables, reports, queries, records, forms, and indexes along with modules, macros, and other stuffs effectively.
- Download Stellar Repair for Access rated Great on Cnet (download starts on this page).
- Click Browse and Search option to locate corrupt Access database.
- Click Repair button to repair & preview the database objects.