954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

MSFlexGrid Search Loop

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.

Attachments kadearlak.zip (30.71KB)
skalra63
Light Poster
30 posts since Feb 2006
Reputation Points: 13
Solved Threads: 0
 

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
skalra63
Light Poster
30 posts since Feb 2006
Reputation Points: 13
Solved Threads: 0
 

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

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 
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.

skalra63
Light Poster
30 posts since Feb 2006
Reputation Points: 13
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You