what i want it to do :
enter a barcode
search grid
if barcode exists then increase Quantity by 1, recalculate subtotal, set vIndex to last row.
if barcode does not exist then search database for data, insert data ( getProduct, currently working)
current code
Private Sub searchItems()
Do Until r = flxItems.Rows - 1
flxItems.TextMatrix(r, 1) = txtProductBarcode
r = r + 1
Loop
If txtProductBarcode = flxItems.TextMatrix(r, 1) Then
currQty = flxItems.TextMatrix(r, 4)
flxItems.TextMatrix(r, 4) = currQty + 1
flxItems.TextMatrix(r, 5) = Format(flxItems.TextMatrix(r, 3) * flxItems.TextMatrix(r, 4), "Currency")
txtProductBarcode = ""
vIndex = flxItems.Row - 1
vIndex = vIndex + 1
Else
Call getProduct
End If
End Sub
the problem
1st item added correctly. subsequent data for (R+1, 1) goes in correct cell but also in the cell (0,1). and other items will not add correctly.
attached is the whole code for the form.
any help woild be great.