Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ADF Scanner In Access Using VBA and WIA

Posted on 2011-02-21
11
Medium Priority
?
3,650 Views
Last Modified: 2012-05-11
I have searched the entire internet and not found a single example that shows VBA code for using a ADF scanner. I am using Miscrosoft Access 2007 and Windows 7. Does any one have a simple code for this using WIA? I can't find anywhere that shows how to specify that you are using a ADF scanner not a flatbed.

Thank you.
0
Comment
Question by:krystalj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 34945397
Did you check the help file that comes with WIA SDK? I know there is an example in it, but I can't recall if it shows using ADF.
0
 
LVL 35

Expert Comment

by:Gary Patterson
ID: 34945568
0
 

Author Comment

by:krystalj
ID: 34945843
I tried the solution from Gary for Excel. I'm using Access and I can't seem to translate it. over Thanks.
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 85
ID: 34946219
The solution at the link by Gary is a standard VBA solution, and would work for Access or Excel. In that link, the "solution" seemed to be for that person to insure that the drivers installed on the machine were the correct ones for the Operating system. Are you certain you're using the correct drivers for the scanner?
0
 
LVL 35

Expert Comment

by:Gary Patterson
ID: 34946279
Not sure what you mean by "can't seem to translate it".  No translation is required.  VBA is VBA.  Doesn't matter if you're using it from Word, Excel, Outlook, Access, whatever.

This fragment is the key section that I think you are looking for.  To determine if a device has an ADF, you loop through the device's Properties collection, and test for:

Property 3087 = ADF
Property 3088 = Page ready in ADF

The code below loops through the device's Properties collection, and if it finds property ID 3087 and 3088, then it means that there is an ADF attached, and at least one more page in the ADF to be scanned.  The boolean values MorePages is set to TRUE if both of these properties are found, and FALSE if they are not both found.

In your code, you just scan a page, and then just repeatedly perform this test to determine if there are more pages to scan.

- Gary Patterson


MorePages = True 
For Each Prop In dev.Properties
   Select Case Prop.PropertyID
      Case 3087 'Document Handling Select (1 = ADF)
         MorePages = MorePages And (Prop.Value = 1)
      Case 3088 'Document Handling Status (1 = Page ready in ADF)
         MorePages = MorePages And (Prop.Value = 1)
    End Select
Next Prop

Open in new window

0
 
LVL 35

Expert Comment

by:Gary Patterson
ID: 34946309
In that link, the "solution" I was actually referring to the example code, not the comments about the driver issue.  

I think krystalj is just looking for a good code example in VBA showing how to scan multiple pages from an ADF, and that is what that code does.

- Gary
0
 

Author Comment

by:krystalj
ID: 34953324
I tried using code recommeded and linked to by Gary the Pro. Unfortuatly it asked for a Macro name when I ran it. Does anyone know where I went wrong/
0
 

Author Comment

by:krystalj
ID: 34953424
One more issue. My clients are hooked up to multiple scanners. I don't know how that is affecting my code. I didn't see any help for wia.selectdevice in VBA
0
 
LVL 35

Accepted Solution

by:
Gary Patterson earned 1500 total points
ID: 34953817
krystalj,

Access probably just wants you to give your VBA "macro" a name.  Create a VBA module or class module to hold your code, and then start pasting code into the module you created.

http://office.microsoft.com/en-us/access-help/get-started-with-access-programming-HA001214213.aspx

BTW, this isn't a full program that you can just cut and paste in.  It is a partial program that demonstrates the technique needed to work with an ADF using WIA in VBA.  You need to know at least a little bit about VBA programming in Access in order to use it.  If you don't have much VBA experience in Access, you probably need to get an experienced VBA consultant to help you with the programming details.

You'll need to look in the WIA Automation SDK for the help file (CHM format) for WIA Automation objects.  Download the SDK, extract it, and open the Help file.  If you are on Vista or newer, you'll need to download the Microsoft HTML Help Viewer, since the CHM viewer isn't included with newer versions of Windows.

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a332a77a-01b8-4de6-91c2-b7ea32537e29
http://msdn.microsoft.com/en-us/library/ms669985%28v=vs.85%29.aspx

You'll need to test your code with each scanner you want to support, to be safe.

- Gary Patterson
0
 

Author Closing Comment

by:krystalj
ID: 34964186
Thank you for your help. I'll get started.

If you can think of any good books on VBA, please let me know. I have not been able to find many
0
 
LVL 35

Expert Comment

by:Gary Patterson
ID: 34964699
Happy to help.  

Go to Amazon.com and search for "VBA".  I got over 2,000 results.

- Gary
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

721 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