Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2012
    Posts
    2

    Unanswered: Capture Bar Code Scan

    The user can either scan a 5 or 6-digit ID (Code39) and the routine checks it against a table of IDs, or if the ID is lost/broken/etc.. you can manually scan each number individually from a card with zero to nine and a Clear & Enter bar code. The program must jump to a different routine (ParseLittleString) to handle the manually scanned individual numbers. The routine is supposed to end on a scan of "U" or "Z". The "U" is clear and "Z" is enter (from Worth Data).
    Problem: After you manually scan a series of individual numbers, the problem arises when you have to manually scan a second ID number. The code is holding on to the number and not clearing it. As long as you do not try to scan back-to-back manual scans, all is good. Any ideas? Anyone have some code to share?

  2. #2
    Join Date
    Jun 2007
    Location
    Maitland NSW,Australia
    Posts
    388
    Post your routine ParseLittleString so we help debug your problem.

  3. #3
    Join Date
    Sep 2012
    Posts
    2

    ParseLittleString code

    Thanks. I am not sure how to do this, so I will just dump the code here?

    Sub ParseLittleString()
    Let Length = Len(Me.tbDOCNUM)
    Let FirstChar = Mid(Me.tbDOCNUM, 1, 1)
    '
    Select Case Asc(FirstChar)
    Case 97 '"a" Line1 in use
    Let ActiveTerminal = 1 'line 1 & 2
    Let charnum = Asc(Mid(Me.tbDOCNUM, 2, 1)) 'Tells variable "charnum" what to be
    Let Me.Line1LName.Caption = "" '
    Let Me.Line1FName.Caption = "" 'Clears previous scans'information
    Let Me.Line1Detail.Caption = "" '
    Let Me.Line1AllergyLabel.Caption = "" '

    If Asc(Mid(Me.tbDOCNUM, 2, 1)) = 85 Then 'user scanned CLEAR
    Let AccumulatedString1 = ""
    Let Me.Line1DocNum.Caption = "CLEARED"
    Let Me.tbDOCNUM.Value = AccumulatedString1
    Exit Sub
    End If

    If Asc(Mid(Me.tbDOCNUM, 2, 1)) = 90 And Len(AccumulatedString1) < 5 Then
    Let AccumulatedString1 = ""
    Let Me.Line1DocNum.Caption = "Enter Again"
    Let Me.tbDOCNUM.Value = AccumulatedString1
    ScanSound ("chord.wav")
    Exit Sub
    End If

    If Asc(Mid(Me.tbDOCNUM, 2, 1)) = 90 And Len(AccumulatedString1) > 4 Then 'user scanned ENTER
    Let Me.tbDOCNUM.Value = AccumulatedString1
    ProcessScan
    Let Me.AccumulatedString1 = "" 'Clears the string for the next manual scan
    Exit Sub
    End If

    If Asc(Mid(Me.tbDOCNUM, 2, 1)) > 47 And _
    Asc(Mid(Me.tbDOCNUM, 2, 1)) < 58 Then 'if a single numeric digit "0"-"9"
    If Len(AccumulatedString1) < 6 Then
    Let AccumulatedString1 = AccumulatedString1 & Mid(Me.tbDOCNUM, 2, 1) 'starts building number after each manual scan
    Let Me.Line1DocNum.Caption = AccumulatedString1
    Else
    Let AccumulatedString1 = ""
    Let Me.Line1DocNum.Caption = "Enter Again"
    ScanSound ("chord.wav")
    End If
    Exit Sub
    End If

    Case 98 ' "b" Line6 in use
    Let ActiveTerminal = 6 'Line 5 & 6
    Let charnum = Asc(Mid(Me.tbDOCNUM, 2, 1)) 'Tells variable "charnum" what to be
    Let Me.Line6LName.Caption = "" '
    Let Me.Line6FName.Caption = "" 'Clears previous scans'information
    Let Me.Line6Detail.Caption = "" '
    Let Me.Line6AllergyLabel.Caption = "" '

    If Asc(Mid(Me.tbDOCNUM, 2, 1)) = 85 Then 'user scanned CLEAR
    Let AccumulatedString6 = ""
    Let Me.Line6DocNum.Caption = "CLEARED"
    Let Me.tbDOCNUM.Value = AccumulatedString6
    Exit Sub
    End If

    If Asc(Mid(Me.tbDOCNUM, 2, 1)) = 90 And Len(AccumulatedString6) < 5 Then
    Let AccumulatedString6 = ""
    Let Me.Line1DocNum.Caption = "Enter Again"
    Let Me.tbDOCNUM.Value = AccumulatedString6
    ScanSound ("chord.wav")
    Exit Sub
    End If

    If Asc(Mid(Me.tbDOCNUM, 2, 1)) = 90 And Len(AccumulatedString6) > 4 Then 'user scanned ENTER
    Let Me.tbDOCNUM.Value = AccumulatedString6
    ProcessScan
    Let Me.AccumulatedString6 = "" 'Clears the string for the next manual scan
    Exit Sub
    End If

    If Asc(Mid(Me.tbDOCNUM, 2, 1)) > 47 And _
    Asc(Mid(Me.tbDOCNUM, 2, 1)) < 58 Then 'if a single numeric digit
    If Len(AccumulatedString6) < 6 Then
    Let AccumulatedString6 = AccumulatedString6 & Mid(Me.tbDOCNUM, 2, 1)
    Let Me.Line6DocNum.Caption = AccumulatedString6
    Else
    Let AccumulatedString6 = "" 'Tried to enter too many numbers
    Let Me.Line6DocNum.Caption = "Enter Again"
    ScanSound ("chord.wav")
    End If
    Exit Sub
    End If
    Case Else
    Let ActiveTerminal = 0 'if no scanner ID, no terminal assigned
    End Select
    End Sub

Posting Permissions

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