Go Premium for a chance to win a PS4. Enter to Win


Taking a Picture with MS WIA

Posted on 2014-11-25
Medium Priority
Last Modified: 2014-11-28

Using WIA (or it's replacement), how can I take a picture and show this in an MS Access form and report ?
imgPic on frmPictures has tblPictures.PicFilePathAndName as its control source.

Your assistance is greatly appreciated.

Kind Regards,
Question by:Mohamed Singh
  • 4
  • 3
  • 2
LVL 58
ID: 40466688
Rather than deal with low level WIA calls, you might want to purchase a control:


LVL 58
ID: 40466693
and by the way, depending on what your doing, dealing with the WIA object library directly may not be all that hard.  For example, it might be as simple as this:

Dim commondialog1 As Object
Dim img As ImageFile
Set commondialog1 = CreateObject("wia.commondialog")
Set img = commondialog1.ShowAcquireImage

img.SaveFile ("c:\test.jpg")

LVL 58
ID: 40466697
I should add that on that link in the first comment, look at the very bottom and view the sample code for frmCapture

Some of it involves dealing with their control, but a lot of it shows you how to work with the WIA lib.

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 26

Accepted Solution

Nick67 earned 2000 total points
ID: 40467230

There are no longer any webcams that have WIA drivers, regrettably.
MS decided DirectShow should be the webcam's driver of choice -- but VBA has no DirectShow support.
That leaves WinAPI if you want a free, and freely distributable solution.

Like the sample attached :)

The sample is ROUGH.
It depends upon a working webcam being installed, and the folder c:\temppdf existing and being freely available.
frmPicParameters has two textboxes.
Enter the number of milliseconds you'd like between snapshots in the LOWER textbox. The upper is used to indicate that the app is active.
frmView is pointed at the images that get blown into c:\temppdf

Since this was for my own use only, I haven't sewn up the niceties
c:\temppdf must be empty
The webcam must exist and not being use by other applications
The error messages when things go BANG! are quite grievous, but the app works

LVL 58
ID: 40467300
He just said he wanted to take a picture...not sure it will be from a webcam.

LVL 26

Expert Comment

ID: 40467459
He's read my WIA articles and asked for this in an unrelated Q
The phrasing there was using WIA to take a pic (using an attached camera/webcam)

Way back, I worked with point-and-shoots that, when jacked in with USB, could be triggered to take a picture.
None of the point-and-shoots in the outfit now (various models of Canon PowerShots) have that ability anymore.
Do you know of any?

Author Closing Comment

by:Mohamed Singh
ID: 40470896
Hi Nick67,
Thank You for your efforts, your contribution and for sharing your hard work.
Kindest Regards,

Author Comment

by:Mohamed Singh
ID: 40470899
Hi Jim,
Thank You for participating.
I will definitely keep DBPix in mind.
Kind Regards,
LVL 26

Expert Comment

ID: 40470904

Your welcome.  I hope it serves the purpose.


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question