OLE objects and saving bitmap to OLE Field in Access

Hello everyone,

I'm using an Access Database to store data for an employee program we are experimenting with. I am using ADO to open a connection to the Access database with visual basic 6.0 with microsoft Jet 4.0

I have installed the plug in for EzVidCap component by Ray Mercer to have a picture capture capability for an ID card maker system. I can make the program save the bitmap to the hard drive, and open it to view in a picture format. I want to save the bitmap to the access database, and be able to open it and view it later in reports and a possible printout for badges.

I have tried everything from saving the captured image to a picturebox on a form, then saving that with an SQL statement into the OLE Field with no success. I have pondered loading an OLEbox and assinging the Captured Image to the olebox, then saving the OLE Box to the access OLE Field. I have not had success with this as the code:

OLE1.Picture = LoadPicture(SavePath)

does not work

Can someone please help me here, I am lost. This is the basic code I am using for the save method.

Private Sub Cmd_Snap_Click()
Dim ProvSSN As String
Dim SavePath As String
Dim PicEdit As Picture
ProvSSN = SSN.Text
SavePath = "c:" & ProvSSN & ".bmp"

ezVidCap1.SaveDIB SavePath

OLE1.Picture = LoadPicture(SavePath) 'Does not work will not load image

Picture1.Picture = LoadPicture(SavePath) 'Works and loads image

Picture1.AutoRedraw = True

If InsertPhoto.State = adStateOpen Then
End If
'setting cursor and open information for recordset table
With InsertPhoto
.ActiveConnection = ProvDB
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Source = "INSERT INTO ATTENDANT (Picture) VALUES ('" & OLE1.Picture & "') WHERE SSN =" & ProvSSN
End With

End Sub

I appreciate any help anyone can give me.


  • Don't store the picture in the db.Store just the path, a lot more easier to manage.
  • Good idea... let me try that then.

    : Don't store the picture in the db.Store just the path, a lot more easier to manage.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!