Textbox & Barcode Scanning

  • Thread starter Thread starter Michael Carroll
  • Start date Start date
M

Michael Carroll

What I want to do is this: Have a userform with a textbox
which will receive information via a scan of a barcode. I
want to have this info sent to a spreadsheet, the textbox
cleared and ready for the next scan. The problem I'm
having is this...I don't want the user to have to do
anything but scan. Ideally, the user should be able to
scan, wait for a 'ding' (a good, clean scan), scan the
next barcode, etc. Ultimately, a list of barcodes will
printout. Any help would be greatly appreciated.

Thanks!
Michael Carroll
 
Use the exit event of the textbox to write the value, clear the textbox,
cancel the departure.

I assume your barcode reader sends a Return at the end of the code.
 
Actually, I think that's part of my problem. Not sure how
or what to use as a "return". I'm not sure how to tell
the userform/textbox that the scan is done. We are using
Code 3 of 9 (with *'s on both ends of the barcode).
 
I believe most barcode readers can be set to emulate keystokes so when it
scans a 9, it sends a keystroke as if a 9 were entered from the keypad. In
this mode, it usually sends a return at the end of the scan although perhaps
this is configurable.
 
Mr. Carroll,

What hardware needs to be purchased to accomplish
this? How much did it cost?

Sincerely,

David Fixemer
 
All you need is a bar code scanner that has a keyboard wedge
interface.
You can program all bar code scanners that have a keyboard wedge
interface to issue an "enter" keystroke after every bar code that you
scan. (This is the default behavior of most scanners.)
You could then use code in your userform that will respond to the
"enter" key and write the data from the textbox to the bottom of a
column and then clear out the textbox and wait for the next scan.

You could use code like the following in your userform:

Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger,
ByVal Shift As Integer)
If KeyCode = 13 Then
KeyCode = 0
R = Sheets(1).Cells(65000, 1).End(xlUp).Row
If Len(Sheets(1).Cells(R, 1).Text) Then R = R + 1
Sheets(1).Cells(R, 1).Value = TextBox1.Text
TextBox1.Text = ""
End If

End Sub

If you need a good bar code scanner that has a keyboard wedge
interface at a very good price, please visit:
http://www.taltech.com/products/bc_reader.html
 
Back
Top