Writing to text file using structure.

Posted 11 December 2012 - 05:41 AM

Hi,this should be an easy question about this inventory program. I am using a structure to write to a text file by date. Now there are two text boxes, a upc text box and a quantity text box. The user inputs upc and quantity and it stores it in an structure. Then I use a if-else statement to seek out the upc within another text file and in the if-else statement is a for loop that stores info and calculations in the structure. Now when I input 2 sets of data with the same upc and write it to text file, it writes both to the file which is supposed to happen but I want to have it only write one upc and the totaled quantity of the same upc. Hope that makes sense?

Basically it appends instead of overwriting the updated upc.
I input 0921115150 as the UPC for both entries and 10 then 12 for the Quantities.
As you can see in the text file it goes by
UPC
Name
Price
Quantity
Sold
The last set is the first entry and the first set is the first entry with the updated quantity info in it. I just want the updated info in it if the same upc is being used with multiple quantities.