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
Solved

ADF Scanner In Access Using VBA and WIA

Posted on 2011-02-21
11
3,485 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
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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 84
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 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
ADODB problem 20 36
Menu Macro ‘Action Failed’, Access 2003 7 15
Calculated field not displaying as currency on form 4 18
XML Node Counting in MS Access VBA 4 31
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

791 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