Hi!.. this is the thread then
The initial problem I had was finally solved. The problem what that I created my Recordset as Readonly
Now the procedure ends correctly, but the data is not saved to the db column
This is the procedure as it is now
Why is this not updating my table's column? It is defined as IMAGECode:Public Function AddNewImage(rstTemp As ADODB.Recordset, _ id As String, sFileName As String) As Boolean '============================================================= Dim file_num As String Dim file_length As Long Dim bytes() As Byte Dim num_blocks As Long Dim left_over As Long Dim block_num As Long On Error GoTo ErrHandler AddNewImage = False 'I decided to use a Filter in order to find the record I need to update rstTemp.Filter = " id_Chofer = " & Cmb_Chofer.Text & "" file_num = FreeFile Open sFileName For Binary Access Read As #file_num file_length = LOF(file_num) If file_length > 0 Then 'I defined a BLOCK_SIZE constant of 250000 since my files will always be not more de 220000 num_blocks = file_length / BLOCK_SIZE left_over = file_length Mod BLOCK_SIZE 'Not using this, so no need to save it to the recordset or the db 'rstTemp("fImageSize") = file_length ReDim bytes(BLOCK_SIZE) For block_num = 1 To num_blocks Get #file_num, , bytes() 'The field name where I want to save the image data is BioID rstTemp("BioID").AppendChunk bytes() Next block_num If left_over > 0 Then ReDim bytes(left_over) Get #file_num, , bytes() rstTemp("BioID").AppendChunk bytes() End If Close #file_num End If 'update RS rstTemp.Update 'Remove Filter rstTemp.Filter = "" AddNewImage = True Exit Function ErrHandler: Debug.Print Err.Description Err.Clear 'Resume Next Exit Function End Function
Thanks




Reply With Quote
