2

I have to open the webCam and take a photo from MS-Access, I was researching, but it has been impossible to do it work. I would appreciate any help that you give me.

I found this

Private Sub Command11_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 = ("C:\Users\Desktop\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
End Sub

this show me enternal cameras, but I need to use the built-in webcam

how is possible get the built-in webCam through MS Access?

PaulFrancis
  • 5,748
  • 1
  • 19
  • 36
Alexander Rojas
  • 125
  • 3
  • 14
  • here some more information: http://www.vbforums.com/showthread.php?378126-WIA-(Windows-Image-Acquisition)-WebCam-Sample-Project – Krish Apr 22 '15 at 09:21
  • @krish Thank you, but I tried that example, I guess WIA can't open integrated webCam. – Alexander Rojas Apr 22 '15 at 14:08
  • MS says:WIA does not support cameras in Windows Vista or later. https://msdn.microsoft.com/en-us/library/windows/desktop/ms630191(v=vs.85).aspx – eddyparkinson Aug 27 '15 at 01:50
  • Vista or later, workaround and other options: http://stackoverflow.com/questions/32110648/how-to-use-mediacapture-api-in-ms-access-to-capture-a-photo?noredirect=1#comment52297810_32110648 – eddyparkinson Aug 27 '15 at 06:46

0 Answers0