Consulting

Results 1 to 5 of 5

Thread: Detecting Barcode Scanner input vs input by hand

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Feb 2018
    Posts
    2
    Location

    Detecting Barcode Scanner input vs input by hand

    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

  2. #2
    VBAX Newbie
    Joined
    Nov 2017
    Posts
    2
    Location
    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.

  3. #3
    VBAX Newbie
    Joined
    Feb 2018
    Posts
    2
    Location
    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

  4. #4
    VBAX Tutor
    Joined
    Mar 2014
    Posts
    210
    Location
    POS via excel would be the worst way. (Access would be better)

  5. #5
    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
    Last edited by J FelixBosco; 03-20-2018 at 07:38 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •