call sub procedure 
Author Message
 call sub procedure

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



Sat, 02 Jul 2005 23:03:08 GMT  
 call sub procedure
Try to comment out the "On Error Resume next" and see what error message you
receive.

--

Kind regards
Hans-Christian Francke
www.master-office.com



Quote:
> 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



Sun, 03 Jul 2005 01:40:31 GMT  
 call sub procedure
I am getting a type mismatch error. I know where. In the
following procedure I am asking for an adodb.field.

Public Sub BlobToFile(fld As ADODB.Field, ByRef FName As
String, Optional FieldSize As Long = -1, Optional
Threshold As Long = 1048576)

In VB I get the value for fld from an adodb recordset. In
access how do I get this information. I am calling the
procedure from a report that is based on a query that has
this field in it.
Thanks for any info.
Chris

Quote:
>-----Original Message-----
>Try to comment out the "On Error Resume next" and see

what error message you
Quote:
>receive.

>--

>Kind regards
>Hans-Christian Francke
>www.master-office.com



>> 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

>.



Sun, 03 Jul 2005 03:25:59 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Calling sub procedures

2. HOW TO Track function, sub and procedure calls ?

3. ??Calling Sub-Menu_Click from Module Level Procedures???

4. Use a variable to call a sub procedure??

5. Sub-Procedure call using Variable

6. Help - sub procedure and a function procedure

7. Help - sub procedure and a function procedure

8. sub report changes its source stored procedure to main report's stored procedure

9. Calling a Sub from another sub How???

10. Calling a sub or function using a variable through another sub or function

11. VBA sub won't call a VB sub

12. Force a sub to wait until another sub (called first by a timer) is finished

 

 
Powered by phpBB® Forum Software