• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • Last Modified:

Getchunk : argument not optional error

I am getting the error 'argument not optional' on line 'bytes() = rs(PFName).GetChunk(Block_Size)' with 'getchunk' highlighted as the error. I took this code from another site so i assume i've not defined something correctly but i don't know what ! Can anyone offer any suggestions ?
Thanks
Dave

Public Sub FillPhoto(rs As Recordset, PFName As String, SizeField As String, Picture1 As PictureBox)
On Error GoTo Handler
Dim bytes() As Byte
Dim file_name As String
Dim file_num As Integer
Dim file_length As Long
Dim num_blocks As Long
Dim left_over As Long
Dim block_num As Long
Dim hgt As Single

    'me.imgPhoto.Visible = False
    Screen.MousePointer = vbHourglass
    DoEvents

    ' Get a temporary file name.
    file_name = TemporaryFileName()

    ' Open the file.
    file_num = FreeFile
    Open file_name For Binary As #file_num

    ' Copy the data into the file.
    file_length = rs(SizeField)
    num_blocks = file_length / Block_Size
    left_over = file_length Mod Block_Size

    For block_num = 1 To num_blocks
        bytes() = rs(PFName).GetChunk(Block_Size)
        Put #file_num, , bytes()
    Next block_num

    If left_over > 0 Then
        bytes() = rs(PFName).GetChunk(left_over)
        Put #file_num, , bytes()
    End If

    Close #file_num

    Picture1.Picture = LoadPicture(file_name)
 
    Screen.MousePointer = vbDefault
Exit Sub

Handler:
    Debug.Print Err.Description
    Resume Next
End Sub
0
wouldbeguru
Asked:
wouldbeguru
1 Solution
 
CarlWarnerCommented:
How To Use GetChunk and AppendChunk Methods of RDO and ADO Object
http://support.microsoft.com/default.aspx?scid=kb;en-us;153238
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now