Saving Pictures To An OLE Field Via Code

jaythom

New member
Local time
Today, 16:47
Joined
Aug 16, 2003
Messages
7
Hello,

I have a form where all of the data is saved via VBA code. On that field is a place for a picture to be displayed. The picture is displayed by users copying a picture to the clipboard, and then clicking the "Paste Picture" button on the form. My problem is when I try and save the picture to the OLE field in the table.

I did not originally know this was going to be as hard as it is turning out. My initial approach was:

rst.Fields("Picture").Value = Me!olePicture

Finding that this did not work, I went looking around and could only find the following (which I am not even sure is being used the right way):

00186 'If Not IsNull(Me!Picture) Or Not IsEmpty(Me!Picture) Then
00187 ' Dim lngOffset As Long
00188 ' Dim lngPictureSize As Long
00189 ' Const conChunkSize = 100
00190 '
00191 ' lngOffset = 0 ' Reset offset.
00192 ' lngPictureSize = Len(Me!Picture)
00193 ' Do While lngOffset < lngPictureSize
00194 ' varChunk = LeftB(RightB(Me!Picture, lngPictureSize - lngOffset), conChunkSize)
00195 ' rst.Fields("Picture").AppendChunk varChunk
00196 ' lngOffset = lngOffset + conChunkSize
00197 ' Loop
00198 'End If

It is "commented-out" because it is not working right now, but I have tried it without the comments.

Does anyone know what I need to do to fix this problem?

Thanks greatly for reading this post and any help anyone can provide!

John
 

Users who are viewing this thread

Back
Top Bottom