Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 18011
Number of posts: 55384

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
OLE objects and saving bitmap to OLE Field in Access Posted by darthmoobey on 9 Sept 2005 at 2:30 PM
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
'Providers\Pictures\
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
        InsertPhoto.Close
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
    .Open
End With

End Sub



I appreciate any help anyone can give me.
Report
Re: OLE objects and saving bitmap to OLE Field in Access Posted by Flakes on 12 Sept 2005 at 9:50 PM
Don't store the picture in the db.Store just the path, a lot more easier to manage.
Report
Re: OLE objects and saving bitmap to OLE Field in Access Posted by darthmoobey on 13 Sept 2005 at 6:27 AM
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.
:




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.