Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding up 1

Status
Not open for further replies.

ryne23

Programmer
Mar 9, 2001
29
US
I am writing a collecting program and I need a way to add the entries up. I want to type in a number and have it automatically add to the total. I am trying to do this without using any VB if at all possible.
 
Could you clarify more of what you are trying to accomplish?
Where do you need the entries added together and output to? I would avoid making any fields in a table with the purpose of holding a result of a calculation.

Gary
gwinn7

 
I will be creating a query to hold the calculation. What it is I actually need is a way to start with 0 total. I will have a field on the form to enter the number of items being added to the inventory. I just haven't been able to get it to add to the total in the query without doubling up the total.
 
OK, am I on the right track here?....

ID NAME AMOUNT
1 hat 5
2 shoes 10

"SELECT Sum(Amount) as Total FROM MyTable;"

The query will return the total amount entered for each record (ie. =15). You can discriminate the item by adding a WHERE clause to the SQL (ie. WHERE Name = 'hat').

What am I missing?

Gary
gwinn7
 
Your are on the right track. Is the field "hat" in the query only or have you added it to the table. I really don't want a permanten record of the amount added, only the total. That way when i pull this item up again I will be able to add more to the total.
 
The inventory table has a record referencing "hat". The 5 represents the number of hats in the inventory. In which case, the query I provided is not needed.

However, if you change the total number of "hats" in the table, there will be no record of the change. Are you sure you don't want to track how your inventory was altered and when? This will not help your paper trail if this is the case.

If this is the case, simply choose an unbound field to store the amount of inventory to add or reduce and update the 'Amount' field appropriately depending on the item.

Does this help?

Gary
gwinn7
 
Yeah, I think this will help alot. Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top