title: VBA Barcode scanner return only first digit, How to Return the Full Number
body: <p>When I scan the barcode, it only shows me the first number of barcode in the TextBox1 instead of the full length number which doesn't allow me to test any other conditions except &quot;Wrong Format&quot;
  I want to have the full barcode so that the other conditions can be tested.</p>
  <pre><code>Private Sub TextBox1_Change()
  Dim scan As String
  Dim premier As Integer
  Dim deuxieme As Integer
  Dim troisieme As Integer
  Dim quatrieme As Integer
  
  scan = TextBox1
  
  
      premier = InStr(1, scan, &quot;-&quot;)
      deuxieme = InStr(premier + 1, scan, &quot;-&quot;)
      troisieme = InStr(deuxieme + 1, scan, &quot;-&quot;)
      quatrieme = InStr(troisieme + 1, scan, &quot;-&quot;)
      
      If premier = 9 And deuxieme = 18 And troisieme = 22 And quatrieme = 27 Then
          magnetA = InStr(1, scan, &quot;A&quot;)
          magnetB = InStr(1, scan, &quot;B&quot;)
          disque = InStr(1, scan, &quot;D&quot;)
          
              'MAGNET A'
              If magnetA = 28 Then
              TextBox1.BackColor = RGB(0, 255, 0)
              TextBox2.SetFocus
              MsgBox &quot;Magnet A detecté !&quot;
              End If
              
              'MAGNET B'
              TextBox1.BackColor = RGB(0, 255, 0)
              If magnetB = 28 Then
              TextBox2.SetFocus
              MsgBox &quot;Magnet B detecté !&quot;
              End If
              
              'DISC  '
              TextBox1.BackColor = RGB(0, 255, 0)
              If disque = 28 Then
              TextBox2.SetFocus
              MsgBox &quot;Disque detecté !&quot;
              End If
              
      End If
      
      'WRONG FORMAT'
      If premier = 0 And deuxieme = 0 Then
              TextBox1.BackColor = RGB(255, 0, 0)
              MsgBox &quot;format incorrect !&quot;
              TextBox1.BackColor = RGB(255, 255, 255)
              TextBox1 = &quot;&quot;
      End If
      
      'BRAKE'
      If premier = 9 And deuxieme = 11 Then
              TextBox1.BackColor = RGB(0, 255, 0)
              TextBox2.SetFocus
              MsgBox &quot;Numero frein detecté !&quot;
      End If
  
  End Sub
  
  </code></pre>