[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

Accepting a scanned barcode value


   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.


1 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now