title: Capture image from camera and save it
body: <p>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).</p>
  <p>I am using windows 10 with office 2010 or office 365.</p>
  <p>Code with WIA:</p>
  <pre class="lang-vb prettyprint-override"><code>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 &gt; 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 &quot;No WIA compatible device attached!&quot;
      End If
        
  End Sub
  </code></pre>
  <p>With this I open my iPhone camera (usb attach). I need to use my in-build camera of my laptop.</p>