Hi There,
Good day to All. First of all I would like to thank GabrielM for his SQL Lookup Table. With just minor changes the Lookup Table was super.
I found 2 problems :
1. Minor Problem: 1st line cannot read from the table.
2. Major Problem: is cannot parse ABZxing scanned code which is in String, but the Cursor1 is using Double/Int/ Long cannot function properly. My table consist of Numbers & also Letters and combination 0f both. How to parse data between all the parameter seamlessly without any problems.
Below is my code & Table.
Thank you guys for your support.
Sub itemABBarcode_BarcodeFound(barcode As String, formatName As String)
Msgbox(barcode, "")
Dim result_vector As Double
Dim lookup_vector As Double
Dim lookup_value As Double
Dim lookup_pre, lookup_post As Double
Dim Cursor1 As Cursor
Cursor1 = SQL2.ExecQuery("SELECT Barcodeold, Barcodenew FROM F")
lookup_value = barcode 'parameter_value
For i = 0 To Cursor1.RowCount - 1
Cursor1.Position = i
lookup_vector = Cursor1.Getdouble("Barcodeold")
'Log(Cursor1.GetDouble("ID"))
Log(Cursor1.GetDouble("Barcodeold"))
If lookup_vector = lookup_value Then
lookup_post = lookup_vector - lookup_value
Cursor1.Position = i
lookup_pre = Cursor1.Getdouble("Barcodeold")
Cursor1.Position = i - 1
lookup_pre = lookup_value - lookup_pre
If lookup_post = lookup_pre Then
Cursor1.Position = i
result_vector = Cursor1.Getdouble("Barcodenew")
EdTextItemCode.Text = result_vector
Else
'Cursor1.Position = i - 1
'result_vector = Cursor1.GetDouble("Barcodenew")
'Cursor1.Position = i
End If
Cursor1.Close
Exit
End If
Next
End Sub
My Table in .txt created using Notepad.
556789, 45789,
342145, 90567, Mop
G223457, U78429,
1, 2,
10E, 20, A
B44512316S, F10,
556789, V45789,
4895057865995, F65995,
4895125708476, F08476,
9555668700034, V00034,
4895057870098, F70098,
4895125745617, F45617
Good day to All. First of all I would like to thank GabrielM for his SQL Lookup Table. With just minor changes the Lookup Table was super.
I found 2 problems :
1. Minor Problem: 1st line cannot read from the table.
2. Major Problem: is cannot parse ABZxing scanned code which is in String, but the Cursor1 is using Double/Int/ Long cannot function properly. My table consist of Numbers & also Letters and combination 0f both. How to parse data between all the parameter seamlessly without any problems.
Below is my code & Table.
Thank you guys for your support.
Sub itemABBarcode_BarcodeFound(barcode As String, formatName As String)
Msgbox(barcode, "")
Dim result_vector As Double
Dim lookup_vector As Double
Dim lookup_value As Double
Dim lookup_pre, lookup_post As Double
Dim Cursor1 As Cursor
Cursor1 = SQL2.ExecQuery("SELECT Barcodeold, Barcodenew FROM F")
lookup_value = barcode 'parameter_value
For i = 0 To Cursor1.RowCount - 1
Cursor1.Position = i
lookup_vector = Cursor1.Getdouble("Barcodeold")
'Log(Cursor1.GetDouble("ID"))
Log(Cursor1.GetDouble("Barcodeold"))
If lookup_vector = lookup_value Then
lookup_post = lookup_vector - lookup_value
Cursor1.Position = i
lookup_pre = Cursor1.Getdouble("Barcodeold")
Cursor1.Position = i - 1
lookup_pre = lookup_value - lookup_pre
If lookup_post = lookup_pre Then
Cursor1.Position = i
result_vector = Cursor1.Getdouble("Barcodenew")
EdTextItemCode.Text = result_vector
Else
'Cursor1.Position = i - 1
'result_vector = Cursor1.GetDouble("Barcodenew")
'Cursor1.Position = i
End If
Cursor1.Close
Exit
End If
Next
End Sub
My Table in .txt created using Notepad.
556789, 45789,
342145, 90567, Mop
G223457, U78429,
1, 2,
10E, 20, A
B44512316S, F10,
556789, V45789,
4895057865995, F65995,
4895125708476, F08476,
9555668700034, V00034,
4895057870098, F70098,
4895125745617, F45617