How to save images in Access DB
Posted: Tue May 13, 2008 8:32 pm
In the samples, there isn't any code on how to save an image in an Access db. Is there a way to save the image in an AccessDB?
Community Forums
https://www.gdpicture.com:443/forum/
Code: Select all
Private Sub Form_Load()
Me.RecordSource = "SELECT * FROM table1"
End Sub
Code: Select all
Dim arBytes() As Byte
If Imaging1.SaveAsByteArray(arBytes, 0, "jpg") = 0 Then
Me.Recordset.Edit
Me.Recordset.Fields("Image").AppendChunk arBytes
Me.Recordset.Update
MsgBox "Image saved"
End If
Erase arBytes
Code: Select all
Dim arbyte() As Byte
arbyte = Me.Recordset.Fields("Image").GetChunk(0, LenB(Me.Recordset.Fields("Image")))
Call Imaging1.CreateImageFromByteArray(arbyte)
Erase arbyte