Connecting Tech Pros Worldwide Forums | Help | Site Map

Subtracting from units In Stock

Newbie
 
Join Date: Jan 2008
Posts: 1
#1: Jan 9 '08
I am having problems subtracting from unitsInStock for all records on my table, for instance; I have Quantity sold, Unit Price,UnitsInStock,Total sales, Stock Balance.

I declared
Dim num1
Dim num2
Dim num3
As General Declaration, then on form load

I wrote
num1 = quantity Sold
num2 = unitsInStock
num3 = Stock balance
num3 = num2 - num1

it worked just once and do not work anytime I update, again it dont work for all my records. Can anyone help please?

jamesd0142's Avatar
Needs Regular Fix
 
Join Date: Sep 2007
Location: Wales
Posts: 467
#2: Jan 9 '08

re: Subtracting from units In Stock


Quote:

Originally Posted by nicekul

I am having problems subtracting from unitsInStock for all records on my table, for instance; I have Quantity sold, Unit Price,UnitsInStock,Total sales, Stock Balance.

I declared
Dim num1
Dim num2
Dim num3
As General Declaration, then on form load

I wrote
num1 = quantity Sold
num2 = unitsInStock
num3 = Stock balance
num3 = num2 - num1

it worked just once and do not work anytime I update, again it dont work for all my records. Can anyone help please?

Ok so you have a table which stores your data, and you want to update the values in the table through vb? if no can you explain what you want?
Moderator
 
Join Date: Oct 2006
Location: Australia
Posts: 7,748
#3: Jan 10 '08

re: Subtracting from units In Stock


Yes, keep in mind that the Form_Load event only occurs when the form is loaded (strange, huh). From the sound of it, you want to do this in an event that is triggered when you change between records or something.

I think we'd need more detail on your situation to provide much more help.
lotus18's Avatar
Site Addict
 
Join Date: Nov 2007
Location: Zamboanga City, Philippines
Posts: 860
#4: Jan 10 '08

re: Subtracting from units In Stock


Quote:

Originally Posted by Killer42

Yes, keep in mind that the Form_Load event only occurs when the form is loaded (strange, huh). From the sound of it, you want to do this in an event that is triggered when you change between records or something.

I think we'd need more detail on your situation to provide much more help.

Yes, I agree with you Killer42.

Hey nicekul, why don't you use command buttons for that?

Rey Sean
Reply