If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Need help with a barcode scanner

I;m making a program that scans a food products barcode and inserts it into a textbox. The progam will then tell you where the food was made. This is done by the first 3 digits of the barcode as it tells us where the product was made.
My question???? How to I essentially pull just these 3 digits out to use as im not interested in the other numbers. I just want the program to recognise the first 3 so it can compare it to a datbase of which country it come from???????
Thanks guys

Re: Need help with a barcode scanner

Well you could use either Left$() or Mid$() to get the portion you want assuming you are talking about working with the data after it is in the textbox then it might look something like this.

Code:

FirstThree=Left$(Text1.Text,3)

The also assumes that you mean the first 3 characters If you actually need the first 3 digits and something else precedes those digits then some tweaking would be required and perhaps use Mid$() instead of Left$() as mid lets you specify both the starting point and number of characters.

Typically I would configure the scanner to send a CR after the data and then check for a CR in the keypress event to trigger the code. That way the code will execute after each scan with no user intervention.

Advertiser Disclosure:
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.