Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2017
    Posts
    1

    Need a Webcam button to capture photo

    Dear Members,



    I have made a mdb file that records works for ID cards. I need to incorporate a button that would take photograph from webcam and automatically transfer the pic on the designated area on the file. Kindly help me at the earliest.

    With Love
    Abhilash DasVisitor-Management.zipVisitor-Management.zip

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    In the VBE (ctl-G) menu, tools, references...
    somewhere in the list is the Webcam driver, checkmark it. Now vb can use it.
    Not knowing which app it is I can only guess, but it would be similar to:

    Code:
    dim cam as new WebCam.application
    
    cam.Photograb.   (Some action here takes the photo)
    TxtBox=cam.image
    Set cam = nothing

  3. #3
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    You should seriously consider purchasing:

    1) AccessImagine - image control (Here)

    or

    2) DBPix - Access Image control (HERE)



    If you are good with VBA coding and have the time to experiment then you can use the Microsoft Windows Image Acquisition (WIA) library.

    Example Code from: WIA: Taking a picture from webcam

    Code:
    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
    
     
    
    'put the path and name for the location of your temp file here.
    tempfile = ("path\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

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Why does photo repaint twice?
    By Bazsl in forum Forms
    Replies: 7
    Last Post: 07-25-2016, 03:16 AM
  2. anyone have an example of a webcam in Access?
    By clebergyn in forum Access
    Replies: 5
    Last Post: 07-02-2014, 01:44 PM
  3. MS Access 2010 capture webcam image
    By rydalplace in forum Programming
    Replies: 5
    Last Post: 01-27-2014, 05:09 AM
  4. How to set an image for a photo directory
    By eninen7 in forum Access
    Replies: 3
    Last Post: 01-11-2011, 12:24 PM
  5. Webcam picture into access
    By sanjib.datta in forum Programming
    Replies: 2
    Last Post: 11-06-2010, 05:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums