AllExperts > Using MS Access 
Search      
Using MS Access
Volunteer
Answers to thousands of questions
 Home · More Using MS Access Questions · Answer Library  · Encyclopedia ·
More Using MS Access Answers
Question Library

Ask a question about Using MS Access
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Scottgem
Expertise
I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience
I've been designing databases for over 15 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

 
   

You are here:  Experts > Computing/Technology > Business Software > Using MS Access > Ignoring Barcode Scanner Input

Using MS Access - Ignoring Barcode Scanner Input


Expert: Scottgem - 7/2/2009

Question
QUESTION: I have an MS Access application where the user is scanning barcodes and a corresponding record in a table is date stamped. This all works fine but I want to include some error trapping. Two sorts - the first when a the barcode is not found in the table and  the second if the barcode has already been scanned. These both work fine and bring up suitable message boxes. But here is the problem -: If the operator doesn't notice the message box and makes another scan the CR at the end of the scanner input closes the message box. A only keyboard Enter or Mouse click on the OK button should close the message box. The Scanner will always send a long (over 10 chrs) string of ascii ending with a CR. Can I trap the difference? any help would be appreciated

ANSWER: This may be possible but it depends on how the scanner input is processed. Does the user just hit the button on the scanner? Or do they press something on the Access form to read from the scanner? In either case, I would need to see what VBA code is kicked off to read the value in the scanner and place it on the Access form. I'm suspecting that the SendKeys command is being used since the CR is being accepted as a keystroke.

Hope this helps,
Scott<>
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

---------- FOLLOW-UP ----------

QUESTION: There is just a textbox (with focus) on a form, but when I trap an error there is a message box popped up. The messsage box is waiting for input and the scanner or the keyboard or the mouse buttons are valid inputs. I have klugged it for now by putting a help button on he message box as default but without any code behind it. The scanner makes the help button 'flash' and the system beeps about ten times. Only the mouse an keyboard can operate the OK button. Its nearly what I want but very ugly.

Answer
Something doesn't make sense. Access doesn't work that way. A scanner is alternative input. For Access to read the scanner some event has to trigger it. That event usually makes a call to software that allows the PC to interface with the scanner. It could be software that is activated when the scanner button is pressed that sends the scanned data to the screen to be "typed" into the textbox.

If the latter is the case. Then you may be able to get away with locking the text box. Something like this:

If IsNull(DLookup("[Barcode]","table","{Barcode] = '" & Me.txtBarcode & "'") Then
 Me.txtBarcode.Locked = True
 If MsgBox("Barcode doesn't exist, Continue?), vbYesNo) = vbYes Then
    Me.txtBarcode.Locked = False
 End If
End If

The point is that you lock the input text box until the user takes some action.

Hope this helps,
Scott<>
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.