Accepting a scanned barcode value

Posted on 2004-11-22
Last Modified: 2010-05-02

   I am working with a form in VB6 linked to an Access db.  I need to be able to have a field on this form accept a scanned barcode value, then search for a record based on that value.  In access alone this works, but I've noticed in vb it does not.  
   The scanner and keyboard are both plugged into a spliter that is plugged into the keyboard jack.  All the barcode scanner does is send the scanned value and a carriage return.  I've noticed there is ther is no OnEnter event in vb.  Is there a way to trigger the search using an 'if' statement on the field, like:

if 'barcode value' And 'carriage return' then
  End If

Or is it something more.  I've notice that even though the search field on myvb form won't accept a carriage return, It doesn't even accept a barcode value.   Any ideas on how to do this (the easy way) would be extremely helpful.


Question by:JermyD
    1 Comment
    LVL 28

    Accepted Solution

    If you are scanning into a Textbox use the Keypress event

    Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
         MsgBox Text1.Text
    End If
    End Sub

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    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…

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now