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.

Resolved.

i just needed Or in it as shown below

Do Until r = flxItems.Rows - 1 or flxItems.TextMatrix(r, 1) = txtProductBarcode
r = r + 1
Loop
Comments
Good Job

Thank you for following up with a solution. It helps in many, many ways, and it's not often that people do it.

Thank you for following up with a solution. It helps in many, many ways, and it's not often that people do it.

no probs. i thought i might aswel post it. people help me with coding, so i thought showing fixed code might help someone sometime in the future.

This question has already been answered. Start a new discussion instead.