I have a lot of images embedded in an Access database. I need to save the images 开发者_如何学运维to a file. How do I do this in VBA?
You need the GetChunk
and AppendChunk
functions.
Here are some MSDN pages about how to load and save images from Access databases:
- How To Read and Write BLOBs Using GetChunk and AppendChunk
- Reading, Storing, & Writing Binary Large Objects (BLOBs)
And here are two example databases for Access 97 and 2000.
(You want the module basBLOB
from in there - the code is based on the second MSDN page)
OLE objects is bad way of storing images in MS Access. Use OLEToDisk (http://www.lebans.com/oletodisk.htm) to save your images as pic files.
After that reimport them in nice way. Check AccessImagine (http://access.bukrek.net) for working with images in Access - it does all the hard job.
精彩评论