Scan two Barcodes and then compare the values (without pressing any keys)
Posted on 2007-03-19
I have two unbound textboxes on a unbound form.
What I want to do is Scan the first Barcode into txtMedBag, then have the focus change to the second textbox (txtSubBracelet). Scan the second barcode into txtSubBracelet and then compare the two Barcode entries.
The following code is in the On Change Event of the Second Textbox (txtSubBracelet):
If Nz(txtMedBag, "") <> txtSubBracelet Then
MsgBox "The Scan Numbers do not Match. " & txtMedBag & ":" & txtSubBracelet
txtSubBracelet = ""
'Cancel = True
'MsgBox "The Scan Numbers Match. " & txtMedBag & ":" & txtSubBracelet
When I scan the barcode, I haven't been able to get the focus to change to txtSubBracelet from txtMedBag, and the code fires and only grabs the first character from the bar code scanner (Symbol Brand - USB). I've read numerous threads here on EE, yet none have pointed me in the right (specific) direction.
What I have works (perhaps not as efficiently as possible) when the User presses the Enter or Tab keys.
Thanks for your Help, Imoutwest.