Barcode problem

Visual Basic
Hi. I have 2 problems in the software that i am doing: 1)I made a function on the textbox_changed so when he reads the barcode he will search in the database for the product info. The problem is that he is searching for each letter or number. ex: 56874474444 he will search after the 5, then after the 56 the after the 568 ... which will take time in a bid db. Whats the solution for such problem. 2)Also i have a problem while reading 2 barcodes that one of them is smaller than the second. ex: 7373 and 73738474, he will always give the info of the small one. Thx.

Answer Wiki

Thanks. We'll let you know when a new response is added.

On the first part of the question, the scanner should be able to be setup to add a “postamble” to the barcode read, in that if the barcode is 123456789, the value returned would be 123456789[CR]. Then, you would check the last character in the text box to see if it is a [CR] and do the search at that point. (All the barcode readers I’ve worked with have had that capability.) This should take care of the second part as you would not be searching the database until the character(s) you had set up as the ending character(s) of the barcode is(are) sent to the textbox by the barcode reader. Remeber, also, to clear the value of the value in the textbox at the end of the search code, so that it can be ready for the next value to be sent from the barcode reader.


Ed Lorden
Snorkel Software

Discuss This Question: 2  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • CharlesJC
    mmm555, - For question #1: You can place your DB lookup code in the validate event of the textbox, as that is executed after input is complete vs. during input with the changed event. - For question #2: You mentioned that when reading two different barcodes, of different lengths, that the information for the first barcode is returned. In your example the first barcode was a subset of the second. Does this happen if the two barcodes are completely different, like 7373 and 898432034)? Also, what is the sequence of evets when reading these two barcodes (what else is happening)? Are you reading the barcode into the same field? How much time elapsed between the reads? Charles
    0 pointsBadges:
  • AaronCutshall
    First of all, do as suggested with the preamble and have the CR sent at the end of the data. Second, don't use the Changed event at all because it fires for every change in the textbox including during character entry. The approach I used is to have a hidden button with it set as the default object so that when the CR was received, the OnClick event would fire. I also set a global variable to the name of the current field in each barcode enabled field's GotFocus event. That way when the button's OnClick event fired, it would know what field it was in and process the data accordingly. Then would allow you to capture barcode information for multiple fields on the same form for a complete scan in each field. HTH, Aaron
    0 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: