Microsoft Access - WebCam(Video) Capture Through MS Access Forms

Asked By Arber on 25-Aug-11 08:47 PM
Can someone tell me how can I connect MS Access with webcams/TV Tunners/etc? I have searched a lot on the internet but I cant get it how I  must implement that code in my CaptureForm? 

I have a Form from which I add/edit the costumer data. But I want to store the pictures of Costumers, taken directly from webcamera.

Can someone please make a simple sample of this problem. That would be really a huge help for many people.
Venkat K replied to Arber on 25-Aug-11 10:07 PM
You can do a reference to any third party dll which has the capability to capture the image from webcam.
I suggest you can use Logitech QUickcam Pro 3000 using MS Access and refer the .dll file. You can get the dll from here:
This also consists of forums where you can get some support.

once you refer the dll you can use the below code to save the image from the web cam.
Put this code in a form.
Form must have a button "btnTakePicture" and image "Image1"

Private Sub btnTakePicture_Click()
'Take a picture from a webcam and store it in a temp file.
'By Justin Johnson Nov 26, 2007

'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

tempfile = ("C:\filename.jpg") 'put the path and name for the location of your temp file here.

'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

Set Commondialog1 = New CommonDialog
Set imfile = Commondialog1.ShowAcquireImage

If imfile Is Nothing Then
MsgBox "Action aborted"
imfile.SaveFile (tempfile) 'this line saves the picture to a specified file
Me.Image1.Picture = (tempfile) 'this sets the picture on the form to show the new picture
End If

Set mydevice = Nothing
Set item = Nothing
Exit Sub

MsgBox Err.Description, vbOKOnly + vbCritical, "Error Taking Picture"
Resume Exit_btnTakePicture_click

End Sub

Hope this helps!
Jitendra Faye replied to Arber on 26-Aug-11 12:09 AM

This is a simple program and can be use to access webcam from the visual basic 6.

This program checks whether webcam is available or not. If not available simple gives

a message otherwise capture from the webcam and displays in picture box.

This program has 3 diffrent functionality.

  -  Capture from the webcam
  -  Close the webcam
  -  Format the video

'This program check whether webcam is available or not
' if available then capture and displays in picture box

'Created by Dixanta Bahadur Shrestha
'Created Date: 12-March-2006

'Programmer does not garuntees if  not functions well

Global Const ws_child As Long = &H40000000
Global Const ws_visible As Long = &H10000000

Global Const WM_USER = 1024
Global Const wm_cap_driver_connect = WM_USER + 10
Global Const wm_cap_set_preview = WM_USER + 50
Global Const WM_CAP_DLG_VIDEOFORMAT As Long = WM_USER + 41

Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Declare Function capCreateCaptureWindow Lib "avicap32.dll" Alias "capCreateCaptureWindowA" (ByVal a As String, ByVal b As Long, ByVal c As Integer, ByVal d As Integer, ByVal e As Integer, ByVal f As Integer, ByVal g As Long, ByVal h As Integer) As Long


Dim hwdc As Long
Dim startcap As Boolean
Private Sub cmdCapture_Click()
Dim temp As Long

  hwdc = capCreateCaptureWindow("Dixanta Vision System", ws_child Or ws_visible, 0, 0, 320, 240, Picture1.hWnd, 0)
  If (hwdc <> 0) Then
    temp = SendMessage(hwdc, wm_cap_driver_connect, 0, 0)
    temp = SendMessage(hwdc, wm_cap_set_preview, 1, 0)
    temp = SendMessage(hwdc, WM_CAP_SET_PREVIEWRATE, 30, 0)
    startcap = True
    MsgBox ("No Webcam found")
  End If
End Sub

Private Sub cmdClose_Click()
Dim temp As Long
If startcap = True Then
temp = SendMessage(hwdc, WM_CAP_DRIVER_DISCONNECT, 0&, 0&)
startcap = False
End If
End Sub

Private Sub cmdVideoFormat_Click()
 Dim temp As Long
 If startcap = True Then
  temp = SendMessage(hwdc, WM_CAP_DLG_VIDEOFORMAT, 0&, 0&)
End If
End Sub

Follow this link also=

Hope this will help you

Anoop S replied to Arber on 21-Nov-13 03:32 PM
Try with DBPIX on

You can then add an image object to your form, right click it and then capture a webcam image.

There should be a way to automate it from VB for applications,
Adith Halid replied to Anoop S on 27-Mar-17 04:28 AM
How to setting webcamera for capture picture using ms access