MSFlexGrid Search Loop

Thread Solved

Join Date: Feb 2006
Posts: 30
Reputation: skalra63 is an unknown quantity at this point 
Solved Threads: 0
skalra63 skalra63 is offline Offline
Light Poster

MSFlexGrid Search Loop

 
0
  #1
Apr 5th, 2006
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, 33 views)
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 30
Reputation: skalra63 is an unknown quantity at this point 
Solved Threads: 0
skalra63 skalra63 is offline Offline
Light Poster

Re: MSFlexGrid Search Loop

 
1
  #2
Apr 6th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: MSFlexGrid Search Loop

 
0
  #3
Apr 6th, 2006
Thank you for following up with a solution. It helps in many, many ways, and it's not often that people do it.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 30
Reputation: skalra63 is an unknown quantity at this point 
Solved Threads: 0
skalra63 skalra63 is offline Offline
Light Poster

Re: MSFlexGrid Search Loop

 
0
  #4
Apr 6th, 2006
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.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC