Storing pdf in Access database (1 Viewer)

JohnPapa

Registered User.
Local time
Today, 16:32
Joined
Aug 15, 2010
Messages
954
Is it possible to store an existing pdf file in the Access db and subsequently show it on a form?

I know about the Attachment data type and the bloating issues. I want to store a small fixed number of images that I would like to show in a form, hence no bloating and files will be stored in the FE.

I have done this with bmp files and ole controls, but it appears that ole is on its way out.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:32
Joined
May 7, 2009
Messages
19,169
just Add an Attachment field.
what filetype do you want to add pdf or images?
to add a file, right-click on the field to show the menu to add attachment.
 

strive4peace

AWF VIP
Local time
Today, 09:32
Joined
Apr 3, 2020
Messages
1,003
@JohnPapa, if the files are images, maybe better would be to use an image format such as JPG or PNG instead of PDF? Then you can store the images as shared resources. Here's a link but it's not very helpful:

Peter Cole @petertheme has done a lot with shared images, maybe he'll jump in
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 14:32
Joined
Sep 21, 2011
Messages
14,044
Is it possible to store an existing pdf file in the Access db and subsequently show it on a form?

I know about the Attachment data type and the bloating issues. I want to store a small fixed number of images that I would like to show in a form, hence no bloating and files will be stored in the FE.

I have done this with bmp files and ole controls, but it appears that ole is on its way out.
Yes, I just did it with the Northwind DB as a test.
 

petertheme

New member
Local time
Today, 14:32
Joined
Feb 25, 2022
Messages
12
Are you using one form and displaying different images depending on a condition or are there multiple forms?
As Crystal suggested if you are viewing images png or jpg are best.

With a form open in Design view, you can add images (pdf or jpg) to the Image gallery that can then be used on any form, report, or control.

inserttogallery.png

Browse to an image and select it. The image will be inserted on the form and added to Shared Images. You can delete the image from the form by pressing escape or deleting the control.

To add the images to forms open each form in design and choose the required image from the insert Image Gallery.

The images are stored in the hidden table MSysResources. The name is the name used by the "Picture" property of the control where the "Picture Type" is "Shared".

If you will be displaying different images depending on a condition then you have 2 options.
1 Use MSysResources and make the Name of the image relate to the condition. You can rename by right-clicking the image in the gallery. When the condition changes you change the "Picture" property to the Name from MsysResources and the image will change.

2 Having added your images to MSysresources make a copy of the table, adjust the image names as required and use the new table as a source for the images on your forms. You can then remove the images from the gallery by right-clicking and deleting them.

MSysresources is automatically created by Access for Accdb 2010 and above. It initially has 1 entry which is the default theme. Usually Office Theme.
 

Cronk

Registered User.
Local time
Tomorrow, 01:32
Joined
Jul 4, 2013
Messages
2,770
Unless you are certain that the number of images will never be more than a handfull, store and load a link to the file which is stored outside Access. Otherwise you will find your accdb growing too much.
 

Users who are viewing this thread

Top Bottom