Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attempting to get binary data out of Access database

Status
Not open for further replies.

sbilbrey

Programmer
Nov 24, 2003
4
US
Experts,

I am attempting to get the contents of a OLE Object out of a Access database and into a file. I am using the following code:

Dim imageData() As Byte
...
Open blobFilename For Binary Access Write As blobFileNum
ReDim imageData(myRS.Fields(i).ActualSize) As Byte
If myRS.Fields(i).ActualSize > 0 Then imageData() = myRS.Fields(i).GetChunk(myRS.Fields(i).ActualSize)
Put #blobFileNum, , imageData()
Close #blobFileNum

I get a file, but I can't open the file. Any ideas would sure be appreciated.
 
Just a thought, but in the line


If myRS.Fields(i).ActualSize > 0 Then imageData() = myRS.Fields(i).GetChunk(myRS.Fields(i).ActualSize)

since you redimmed the imageData variable, you need to state which index you are saving it to.

i.e. imagedata(1) = ....

good luck

baugie
[cheers]
 
If it is an OLE Object you will need to use an OLE Container control, and DAO, in order to display it.
Different from just saving a picture or whatever as long binary data and then retrieving it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top