Results 1 to 3 of 3
  1. #1
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    185

    Barcode Scanner Invalid Scan

    I am trying to deceiver this code here to see why a process is causing an invalid scan. This had previously been working but it reached its 2 GB limit and started having issues. I ran the compact and repair and it worked but I am still having issues with this code. I scan a sample ticket that reads like this
    1 04 0331 83233 01. I can't scan the full number to the table without an invalid scan. This table is then exported to a flash drive then entered in a mainframe. Here is the code

    Option Compare Database
    Dim ScanTimeVar, StoreVar, LookUpVar ', CurrentVar, DiffVar

    Private Sub Form_Load()


    ScanTimeVar = Now()
    DoCmd.GoToRecord , , acNewRec
    End Sub

    Private Sub Scan_BeforeUpdate(Cancel As Integer)
    Forms![ScannerForm-Main]![LastTime] = Now()
    StoreVar = (Mid(Me![Scan], 4, 4))
    If IsNull(StoreVar) = False And IsNumeric(StoreVar) = True Then
    StoreVar = Int(StoreVar)
    LookUpVar = DLookup("STORE", "OpenStores", "STORE = " & StoreVar)
    Else
    LookUpVar = Null
    End If

    If Left(Me![Scan], 3) <> "104" Or Len(Me!Scan) <> 14 Or IsNull(LookUpVar) = True Then
    Beep
    Beep
    Beep
    Beep
    Beep
    MsgBox "Invalid Scan", vbCritical
    Beep
    Beep
    Beep
    Beep
    Beep
    'SendKeys "{Esc}"
    'Me!Scan = Null
    DoCmd.CancelEvent
    SendKeys "{Esc}"
    SendKeys "{Esc}"

    End If

    End Sub

    Any suggestions?

    I have tried removing the If left statement that was sending the invalid scan but then I am not able to import that scan into the mainframe.

    Thanks,
    Nick

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Is the scan value with or without the blanks? Your sample that "looks like this" does contain blanks, but your code seems to assume that it doesn't.

    Which is correct?

    You could use msgbox or debug.print at the start of the procedure to see what Me![Scan] actually contains - maybe the problem is not in this procedure.

  3. #3
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    185
    This sample is without blanks when it is scanned in. I have found since posting this that I am able to scan in the barcodes once I take out the code "if left me scan" statement. I used the word pad to do test scans and I figured out that my first scanner was incorrectly programmed. I have a correct scanner now as it seems. I am now having an issue with focusing by having the table pated into the mainframe. I have to click the mainframe to the focus or the go to record statement will fail. This seems to be my problem now.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Barcode scanner
    By Business in forum Programming
    Replies: 1
    Last Post: 05-22-2016, 08:48 AM
  2. Scan Snap IX500 Scanner
    By angie in forum Programming
    Replies: 3
    Last Post: 06-25-2015, 10:30 AM
  3. Barcode scanner for small project
    By miziri in forum Programming
    Replies: 7
    Last Post: 05-20-2011, 01:50 AM
  4. Barcode Scan input
    By Nem3s1S in forum Database Design
    Replies: 4
    Last Post: 09-26-2009, 09:43 AM
  5. Replies: 1
    Last Post: 12-30-2008, 08:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums