I have a report that is trying to call a procedure. The
code takes the blod data from a table and converts it
back to a file so I can show the image in a report. I
have included the code. When stepping through the code it
gets to the procedure call but doesn't go to the
procedure, just steps to the next line of code. What am I
missing?
Thanks for the help.
Option Compare Database
Const BLOCK_SIZE As Long = 16384
Private Sub Detail_Format(Cancel As Integer, FormatCount
As Integer)
On Error Resume Next
'Me![imgProImagePicture].Picture = Me!
[txtProImagePicture]
If Me![ProcessImage].Value <> "" Then
Call BlobToFile(Me!
[ProcessImage], "C:\Photo1.dat", Me![ProcessImage], 16384)
Me![imgProImagePicture].Picture = LoadPicture
("C:\Photo1.dat")
End If
End Sub
Public Sub BlobToFile(fld As ADODB.Field, ByRef FName As
String, _
Optional FieldSize As Long = -1, _
Optional Threshold As Long = 1048576)
Dim F As Long, bData() As Byte, sData As String
F = FreeFile
Open FName For Binary As #F
If FieldSize = -1 Then
WriteFromUnsizedBinary F, fld
Else
If FieldSize > Threshold Then
WriteFromBinary F, fld, FieldSize
Else
bData = fld.Value
Put #F, , bData
End If
End If
Close #F
End Sub
Public Sub WriteFromUnsizedBinary(ByVal F As Long, fld As
ADODB.Field)
Dim Data() As Byte, Temp As Variant
Do
Temp = fld.GetChunk(BLOCK_SIZE)
If IsNull(Temp) Then Exit Do
Data = Temp
Put #F, , Data
Loop While LenB(Temp) = BLOCK_SIZE
End Sub
Public Sub WriteFromBinary(ByVal F As Long, fld As
ADODB.Field, _
ByVal FieldSize As Long)
On Error Resume Next
Dim Data() As Byte, BytesRead As Long
Do While FieldSize <> BytesRead
If FieldSize - BytesRead < BLOCK_SIZE Then
Data = fld.GetChunk(FieldSize - BLOCK_SIZE)
BytesRead = FieldSize
Else
Data = fld.GetChunk(BLOCK_SIZE)
BytesRead = BytesRead + BLOCK_SIZE
End If
Put #F, , Data
Loop
End Sub