944,018 Members | Top Members by Rank

Ad:
Apr 5th, 2006
0

MSFlexGrid Search Loop

Expand Post »
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

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub searchItems()
  2. Do Until r = flxItems.Rows - 1
  3. flxItems.TextMatrix(r, 1) = txtProductBarcode
  4. r = r + 1
  5. Loop
  6. If txtProductBarcode = flxItems.TextMatrix(r, 1) Then
  7. currQty = flxItems.TextMatrix(r, 4)
  8. flxItems.TextMatrix(r, 4) = currQty + 1
  9. flxItems.TextMatrix(r, 5) = Format(flxItems.TextMatrix(r, 3) * flxItems.TextMatrix(r, 4), "Currency")
  10. txtProductBarcode = ""
  11. vIndex = flxItems.Row - 1
  12. vIndex = vIndex + 1
  13. Else
  14. Call getProduct
  15. End If
  16. 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.
Attached Files
File Type: zip kadearlak.zip (30.7 KB, 229 views)
Similar Threads
Reputation Points: 13
Solved Threads: 0
Light Poster
skalra63 is offline Offline
30 posts
since Feb 2006
Apr 6th, 2006
1

Re: MSFlexGrid Search Loop

Resolved.

i just needed Or in it as shown below
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Do Until r = flxItems.Rows - 1 or flxItems.TextMatrix(r, 1) = txtProductBarcode
  2. r = r + 1
  3. Loop
Reputation Points: 13
Solved Threads: 0
Light Poster
skalra63 is offline Offline
30 posts
since Feb 2006
Apr 6th, 2006
0

Re: MSFlexGrid Search Loop

Thank you for following up with a solution. It helps in many, many ways, and it's not often that people do it.
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Apr 6th, 2006
0

Re: MSFlexGrid Search Loop

Quote originally posted by Comatose ...
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.
Reputation Points: 13
Solved Threads: 0
Light Poster
skalra63 is offline Offline
30 posts
since Feb 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: dll in VB
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: hello hope you can help me, have a look and let me know





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC