I want to add a button in my form(MS Access Database), so it can capture image from my camera(laptop) and save it in a specific location (c:\image). I am using windows 10 with office 2010 or office 365.
Any ideas or help.
Thank you.
Ps Update code with WIA:
Private Sub Command1_Click()
Dim oWIA_DeviceManager As WIA.DeviceManager
Dim oWIA_Device As WIA.Device
Dim oWIA_ComDlg As WIA.CommonDialog
Dim oImageFile As WIA.ImageFile
Dim i As Long
Set oWIA_DeviceManager = New WIA.DeviceManager
If oWIA_DeviceManager.DeviceInfos.Count > 0 Then
Set oWIA_ComDlg = New WIA.CommonDialog
' Index the Devices property starting here at 1, not 0 .
For i = 1 To oWIA_DeviceManager.DeviceInfos.Count
Set oWIA_Device = oWIA_DeviceManager.DeviceInfos.Item(i).Connect
' Use this to show Acquisition CommonDialog
Set oImageFile = oWIA_ComDlg.ShowAcquireImage
' Use this to show Acquisition Wizard
'Set oImageFile = oWIA_ComDlg.ShowAcquisitionWizard(oWIA_Device)
Next i
Else
MsgBox "No WIA compatible device attached!"
End If
End Sub
With this I manage to open my iPhone camera (usb attach). I need to use my in-build camera of my laptop.
Thank you
In the past I have used WIA (Microsoft Windows Image Acquisition) for scanners but it will work with webcams. I'd definitely try it.
This page is probably what you need. http://www.developerfusion.com/thread/46191/how-to-capture-picture-using-webcam-in-vb60/
Basically what this is doing is using the windows message pump to send messages to web cam driver, asking it to take a picture. Also, a tip for future self help. You can often get better results by searching VB6, which is almost the exact same thing as VBA. VBA just has a few less functions.
If you lack the common dialog control. You can change the code to this