Does anyone have experience with 1) showing the person's image live, on the Access form, before the picture (so they can center themselves beforehand, look into the camera, etc...), then 2) taking the picture and storing the result in a designated location?
Code:
Private Sub btnTakePicture_Click()
'https://social.msdn.microsoft.com/Forums/en-US/1e9eebcb-5abe-404d-882b-5cb302b771e4/wia-taking-a-picture-from-webcam?forum=isvvba
'Take a picture from a webcam and store it in a temp file.
'By Justin Johnson Nov 26, 2007
'Add to VBA References: Microsoft Windows Image Acquisition Library v2.0
On Error GoTo Err_btnTakePicture_click
Dim tempfile As String
Dim mydevice As WIA.Device
Dim item As WIA.item
Dim imfile As WIA.imagefile
Dim Commondialog1 As WIA.CommonDialog
'put the path and name for the location of your temp file here.
tempfile = ("http://sharepoint/Contacts/filename.jpg")
'the next 4 lines deletes the old temp file if it exists
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
If FileSystemObject.FileExists(tempfile) Then
Kill (tempfile)
End If
'the next two lines set up the configuration
Set Commondialog1 = New CommonDialog
Set mydevice = Commondialog1.ShowSelectDevice
Set item = mydevice.ExecuteCommand(wiaCommandTakePicture) 'instructs the camera to take the picture
Set imfile = item.Transfer 'transfers the picture from the camera
'this line saves the picture to a specified file
imfile.SaveFile (tempfile)
'this sets the picture on the form to show the new picture
Me.OLEUnbound1.Picture = (tempfile)
MsgBox "Picture taken"
Exit_btnTakePicture_click:
Set mydevice = Nothing
Set item = Nothing
Exit Sub
Err_btnTakePicture_click:
MsgBox Err.Description, vbOKOnly + vbCritical, "Error Taking Picture"
Resume Exit_btnTakePicture_click
End Sub