Access OLE file size

Kowalski

Registered User.
Local time
Today, 07:24
Joined
Jul 5, 2007
Messages
121
Hi
I'm looking for a way to check the size of the file that was used to populate an Access OLE field.

I've got a file on hard drive (any type), and I then add it to an Access database's OLE field. Now I would like to know how big was the orginal file.

I tried the Access Len(OleField) function, but that is not accurate - probably because of the headers that Access add to OLE objects.

I also tried to save the OLE field back as a file on the hard drive (on 3 different ways) but the new file's size is not the same as the file before it was added as the OLE object.
Especially PDF files are 10x bigger.
Any ideas?
 
Do you have a form that you use to select the file to be loaded?
If you do, I would assume that you use the commondialog control...
Could you not use a variable and store the size in a variable at time of selection?

MyFileSizeStringVariable = FileLen(Commondialog1.open) & " bytes"
 
Hi
There is a form yes, but your solution will only work sometimes as users can still open the form and drag-and-drop a file in there. They can also copy and paste contents, and then I won't know from where the file came.
We need the preview of the form and I don't want to remove functionality (like the drag and drop) for this.
Thanks for the reply.
 
Here is a method of calculation that may indicate the space taken but an OLE assuming a bitmap format Access 2003 and earlier versions to calculate:

([Image Width] * [Image Height] * [24 Bit Color]) / (8 * 1024) = [File Size (in KB)]

500 x 500 pixel bitmap image

(500 * 500 * 24) / 8192 = 733KB

1000 x 1000 pixel bitmap image, the resulting file size is 4 times the size.

(1000 * 1000 * 24) / 8192 = 2,930KB

The original jpg (500 x 500) file was 44KB

The reason the jpg file is so small is that at the beginning of the compression process, 8 x 8 pixels blocks are used and averaged out, hence the lossy nature of transitional tones. Luminosity is increased to compensate for the loss of colour definition.

As mentioned by a previous poster, we don't store images in a database particularly one that uses bitmaps as each and every pixel is stored.

Simon
 
Thanks for info, but as you mentioned its only good for bitmaps. The OLE will contain any docs, and will mainly comprise out of Word, Excel, PDF and MS Project.
So I would need a generic method to calculate file size. Tx for reply.
 
My understanding of OLE previous to Access 2007 was that an the file was converted to an bitmap image. I was so disgusted with this treatment that I have avoided Objects as Large as Elephants ever since.

The other considerations are: as these files already exist it seems pointless to replicate the files although I do operate databases with thousands of images and understand the functionality of integration. Furthermore taking the example already given if there are blobs (binary large objects) in the database each time the database is interogated the read has to hurdle over these blobs which take up the majority of the database file and you are creating a considerable overhead.

Simon
 

Users who are viewing this thread

Back
Top Bottom