Others

How to Fix Run-time Error 13146 When Embedding PNG in Access OLE Object via VBA

Muhammad TalhaMuhammad Talha Oct 26, 2026 869 views

Question details

The user needs to resolve run-time error 13146 that occurs when executing VBA code to embed a PNG file into an Access OLE Object column.

How to Fix Run-time Error 13146 When Embedding PNG in Access OLE Object via VBA
Product
Microsoft Access
Device & OS
not provided
Scenario
Automating the process of converting an attachment into an OLE Object field using VBA scripting.
Observed behavior
The VBA code successfully attaches the image manually but fails with run-time error 13146 when programmatically attempting to embed a PNG file.
Before you start

Verify that your Windows operating system has a default application associated with PNG files that functions as an OLE server, such as Microsoft Paint.

Solution 1Recommended

Link the PNG File Instead of Embedding

Modify the VBA code to link the PNG file instead of embedding it, which bypasses the OLE server limitation for this specific file format.

Certain image formats, like PNG, are not natively supported for OLE embedding depending on the system's registered OLE servers. Changing the OLE frame action from embedding to linking resolves the run-time error while still displaying the image.

1
Open the VBA Editor

Open your Microsoft Access database and press ALT + F11 to launch the Visual Basic for Applications (VBA) editor.

2
Locate the OLE Embedding Code

Find the specific line in your script where the action property is set to acOLECreateEmbed.

3
Change Action to Link

Replace acOLECreateEmbed with acOLECreateLink to instruct Access to link the external file.

4
Verify File Path

Ensure that the SourceDoc property points to the correct, accessible file path of the PNG image.

Adjust Frame Properties: Ensure the OLE Type Allowed property of the Object Frame control in your Access form or report is set to 'Either' or 'Linked' to permit linked objects.
Free Microsoft Office alternative

Explore WPS Office for Your Document Needs

While Microsoft Access handles databases, WPS Office is a perfect, free, lightweight, and easy-to-use alternative for all your Microsoft Word, Excel, and PowerPoint tasks. Experience a familiar UI and seamless migration today.

Fully compatible with Microsoft Office formats including DOCX, XLSX, and PPTX.Lightweight installation package that ensures fast loading and smooth performance.Familiar user interface that requires zero learning curve for new users.Built-in powerful PDF toolkit for editing, converting, and annotating.
microsoft office alternative - wps office

Frequently Asked Questions

Why does run-time error 13146 happen only with PNG files in Access?

Error 13146 typically occurs because Access relies on Windows OLE servers to embed objects. If the default application assigned to handle PNG files does not support OLE embedding natively, the VBA acOLECreateEmbed command will fail.

Can I manually embed a PNG into an OLE Object field without VBA?

Yes, manual embedding often works because the Access user interface handles the OLE wrapping differently. However, VBA interacts with the system's OLE server directly, which requires the application handling the PNG to fully support programmatic OLE embedding.

What is the difference between acOLECreateEmbed and acOLECreateLink?

acOLECreateEmbed stores a full copy of the file inside the Access database, which increases the total database file size. acOLECreateLink only stores a reference to the file's path on your computer, keeping the database smaller and avoiding certain OLE server limitations.