Link to home
Start Free TrialLog in
Avatar of Sam Cohen
Sam CohenFlag for United States of America

asked on

webcam to capture images and save to file, URGENT!!

I have a web cam im using to show live video in my MS access form, but i want to beable to snap the image and save to file.(sort of like the windows movie maker works , in XP)

so far im using VideoCapFree activex to capture live video.... but how can i take snap shots and save it to .jpg, .bmp.etc?
heres my code:

_------------------

Option Compare Database

Private Sub Command1_Click()
 Me.VideoCap1.Stop
   
End Sub

Private Sub Command16_Click()


End Sub

Private Sub Command2_Click()
On Error GoTo Err_Command2_Click

Dim Bx, Hwn, Scnav As Boolean
Scnav = ScanControl.ScannerAvailable
Select Case Scnav
Case True

'check for file type being used

DoCmd.GoToControl "piclocation"
If InStr(piclocation.Text, ".bmp") Then
VideoPreview1.FileType = BMP_Bitmap
ElseIf InStr(piclocation.Text, ".awa") Then
VideoPreview1.FileType = AWD_MicrosoftFax
ElseIf InStr(piclocation.Text, ".tif") Then
VideoPreview1.FileType = TIFF
End If

'Uncomment the next line to give user scan preferences
'ScanControl.ShowScanPreferences


DoCmd.GoToControl "piclocation"
ScanControl.Image = piclocation.Text



 Me.VideoCap1.Start

'names the file in this case I named it by combining ID and Last Name
Me.Imagepath = Me.NameID & Me.LastName & ".bmp"
Exit Sub

Case False
MsgBox "Scanner is Busy!" + vbCrLf + "Try Again Later.", vbInformation, "Scanner: Busy!"
Exit Sub


End Select
Err_Command2_Click: MsgBox Err.Description

End Sub

Private Sub Command3_Click()
'comment out the next line to select the default cam/scanner
ScanControl.ShowSelectScanner
'VideoCap1.Devices
End Sub
--------------------

please let me know how to add a save image feature..
or if you might know of a better way please let me know!!

I reply quickly~
ASKER CERTIFIED SOLUTION
Avatar of SidFishes
SidFishes
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sam Cohen

ASKER

Hey Sid, Can you help me out with the code, im a 2 year Beginner to vba
Basically im trying to capture video then click a button to snap frames, and once snapped, save to file with a custom filename..

Thanks in Advance!!!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok i see!
basic i have the filename saving as: ImagePath= CapName & ".bmp"
so therefore i will execute sql: insert into MyTable (imagePath) blah blah
but how do stop the camera from running onload?
I want to be able to start and stop at any time..

when i loaded the activex on to the form and viewed it, it automatically as for the device...-- i dont want this to happen , i want beable to choose my device in the form , with other functions

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks...It works great with my Sony camcorder as well!!!
Youre the best Sid!!!!
glad to help