MS Access 条码扫描

MS Access Barcode Scanning

MS Access 的新手,想知道是否有办法判断扫描的条形码是 FedEx 条形码还是 UPS 条形码。据我所知,UPS 有字母数字条码,而 FedEx 有 12 位数字条码。我敢肯定这会有所不同。

我想在名为 "Type_TrackNum" 的 table 中添加另一列,用于存储标签是 FedEx 还是 UPS。我希望将其附加到 CurrentDB.Execute 命令。

这是我目前所拥有的,只要有前导零,这通常会在 FedEx 条形码中找到,这也会切断前导零。

Dim strIn As String
Dim i As Integer
Dim iLen As Integer

strIn = Me.txt_Track.Value
iLen = Len(strIn)

For i = 1 To iLen
    If InStr(strIn, "0") = 1 Then
        strIn = Mid(strIn, 2)
    End If
Next i

CurrentDb.Execute _
    "INSERT INTO TrackNum_Table(TrackingNum_TrackNum) " & _
    "VALUES ('" & strIn & "')"

任何帮助都会有所帮助。

类似

Dim strIn As String
Dim strType As String 'NEW
Dim i As Integer
Dim iLen As Integer

strIn = Me.txt_Track.Value
iLen = Len(strIn)

If IsNumeric(strIn) Then
    strType = "FedEx"

    For i = 1 To iLen
        If Left(strIn, 1) = "0" Then
            strIn = Mid(strIn, 2)
        Else
            Exit For
        End If
    Next i
Else
    strType = "UPS"
End If

CurrentDb.Execute _
    "INSERT INTO TrackNum_Table(TrackingNum_TrackNum, Type_TrackNum) " & _
    "VALUES ('" & strIn & "', '" & strType & "')"