Automatic Refill!!!

G

Guest

I got two text box namely : [Amount] and [Balancer]

Relationship
[Amount] + [Balancer] >= 0

The value [Amount] will reduce everyday until zero. Then, I need the
[Balancer] to automatically increase its value to prevent negative condition
occurs.

eg.
Let say i am a fruit storkeeper
[Amount] increases when i add in "banana" stock but [Amount] cannot be
negative if [Amount] run out of stock.

Hence, what code can automatically make the value of [Balance] to increase
so it can add into [Amount] to prevent [Amount] from being negative.

Data entry==>[Balancer]+[Amount]==>[Amount]==>positive value

eg
Data entry = -20
Automatically [Balancer] = 20
[Amount] = 0 (it will always more or equal to zero)


Any solutions?

Thanks in advance.

Kennykee
 
G

George Nicholson

1) You are using Amount in 2 different ways: as the amount entered and the
result of Entry + Balancer. It can't be both.
2) Not sure under what circumstances a fruit storekeeper would ever
enter -20, but here's your answer:

In AmountEntry_AfterUpdate:
if AmountEntry < 0 then
Balancer = abs(AmountEntry)
else
Balancer = 0
end if
 
K

Ken Snell [MVP]

kennykee said:
eg.
Let say i am a fruit storkeeper


Hmmm.....now this is really starting to look like a homework
problem....."let's say"? I would think that you'd "know"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top