asked on
MS Access file size limit when embedding OLE Object
Take a look at my article :Defeating-the-device-independent-bitmap-dib-format
Its for images but the code that reads the image as file should handle your file.
EDIT: just tried it with a 68 Mb image and it was read just fine
As Gustav mentioned Access is not at its best for handling large size files
Your Options are 2 :
For Local storing (your files are just for 1 user) SQLite is best
If its for Multi User storage then Firebird is probably the best
All SQL Engines are capable of storing files but the 2 above are best suited.
Rather than using the built-in functions, you can store the BLOB data yourself in JET with AppendChunk() and GetChunck(). The only issue is that when you want to view it, you need to write it out to disk before you can do anything with it.
So a better strategy is to store the doc on disk and just link to it rather than bringing it into the DB at all. No reason to either with no real security. A SQL back end would be a different story.
Jim.
ASKER
ASKER
I will make it simple for you David :
A table with a field OLE Object lets name it FileData
On the click event of a form
Dim rst As DAO.Recordset
Dim filePath as String
filePath = "C:\Temp\A_Big_Doc.doc"
Set rst = CurrentDb.OpenRecordset("TableFiles", dbOpenDynaset)
With rst
.AddNew
.Fields("FileData")=FileToBlob(filePath)
.Update
rst.Close
Set rst = Nothing
End With
Function FileToBlob(FilePath As String) As Byte()
Dim B() As Byte
Open FilePath For Binary As #1
ReDim B(LOF(1) - 1)
Get #1, , B
Close
FileToBlob =B
End Function
EDIT : Tested and Working ...see sample
ASKER
Function FileToBlob(FilePath As String) As Byte()
Dim B() As Byte
Open FilePath For Binary As #1
ReDim B(LOF(1) - 1)
Get #1, , B
Close
FileToBlob = B
End Function
send your database...have you checked the filepath ?
ASKER
OK, that loads the file in the table, but that is only be useful if I can now read it back out using the application that created it.
I'll have to set up a test of that to see whether the built in OLE functionality reads it back out normally, or if the file size restriction gets applied to the file when a read attempt is made.
I'll let you know the results when I get them.
ASKER
Thanks for everyone's help, now I have to see if I can make this work with enough reliability for a document control system.
An Access file really isn't very handy for this.
Most recommendations suggest to save such large objects or documents in discrete files and, in the database, only store the links to these.