PDA

View Full Version : Detecting Barcode Scanner input vs input by hand



dave2018
02-11-2018, 07:48 PM
I am working on a POS (point of sale) Program using excel (2016) Vba.

I have a activeX textbox for inputs which can be inputted by hand or by using a barcode scanner.

I need excel to know which way a user has inputted the barcode. (either by hand or by barcode-scanner)

How can i see this using vba code? (keep in mind that barcode scanners input values much quicker than a human does, so probably a solution is seeing the timing difference or something like that..)

-Thanks

bradl822
02-12-2018, 04:20 AM
Hi Dave, are you trying to prevent manual entry all together? Or you simply want to know what entry method was used? Two very different codes is all.

dave2018
02-12-2018, 09:31 AM
thx for responding :) (this is actually my first question on this forum)

i meant that i wanted a code to see which method was used. (why would it be a different code? the same way to detect a input by hand could trigger that the textbox.value should reset to "")

thx

ranman256
02-12-2018, 11:03 AM
POS via excel would be the worst way. (Access would be better)

J FelixBosco
03-20-2018, 06:22 AM
I don't have barcode scanner to check below code. If you want to prevent user input from hand below code might be helpful. Please save and backup your data before using below code. If code fails after executing "Blockinput True" you will have to restart your pc.


Declare Function BlockInput Lib "USER32.dll" (ByVal fBlockIt As Long) As Long

Private Sub TextBox1_GotFocus() ' ActiveX textbox event
BlockInput True
End Sub


Private Sub TextBox1_LostFocus() 'ActiveX textbox event
BlockInput False
End Sub