PDA

Click to See Complete Forum and Search --> : Check whether Item is already in Datagrid??


Neumee
Mar 6th, 2003, 11:54 PM
Here's what I need to do....

I have a invoice form. It has a datagrid on it....

I have a label that I click which opens a "parts form"..

from the parts form you click the part you want to add to the invoice.. (this form displays the parts in a datagrid aswell)

But If the part already exsists in the invoice form datagrid..I dont want to add it again...but add 1 to the Qty of the exsisting part??

Thanks for the help in advance!!

Neumee
Mar 7th, 2003, 10:53 AM
Here is a little more info if this helps at all??

When I update the database is when the Invoice form closes....But I need to determine, if the part is already in the dataset when I click on the part I want to add from the parts form. The 2 datasets are not bound together.

So if I click on a part to add to the invoice....it just copies a string representation to the dataset of the invoice form


drCurrent = oldform9.mPartsNumber.NewRow()

drCurrent("PAR_NUMBER") = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, 0)
drCurrent("PAR_DISC") = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, 1)
drCurrent("PAR_LIST") = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, 3)
drCurrent("STOCK") = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, 2)

oldform9.mPartsNumber.Rows.Add(drCurrent)


I'm not sure the code to check if it already exists...so if you could give me an example that would be great....

And I've never worked with Stored Procedures....would it benifit me to do it that way??

Thanks again