User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 392,071 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,248 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 2718 | Replies: 3 | Solved
Reply
Join Date: Feb 2006
Posts: 30
Reputation: skalra63 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
skalra63 skalra63 is offline Offline
Light Poster

MSFlexGrid Search Loop

  #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

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.
Attached Files
File Type: zip kadearlak.zip (30.7 KB, 19 views)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2006
Posts: 30
Reputation: skalra63 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
skalra63 skalra63 is offline Offline
Light Poster

Re: MSFlexGrid Search Loop

  #2  
Apr 6th, 2006
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
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: MSFlexGrid Search Loop

  #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  
Join Date: Feb 2006
Posts: 30
Reputation: skalra63 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
skalra63 skalra63 is offline Offline
Light Poster

Re: MSFlexGrid Search Loop

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 12:03 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC