qty bought should be less than or equal to the inventory balance

  • Thread starter hugz via AccessMonster.com
  • Start date
H

hugz via AccessMonster.com

I have a txtbox that shows the inventory level and another txtbox for the
customers to enter the quantity they want to purchase. I had this code using
Visual basic on an after update and after enter event on the amount puchased
txtbox, that if the amountpurchased txtbox is greater than the inventory
level txtbox a message will appear saying that the amount purchased should
not exceed the inventory level.

The problem is for example when the inventory level is 20. When i enter 3 on
the amount purchased txtbox the message appears. but when i enter 03 on the
amount purchased txtbox, it works properly. same result as when the inventory
level is 36 for example and when i enter 7 on the amount purchased the
message appears. and it works properly when i enter 07. can anyone help me on
this..

thnx for all the help
 
D

Duane Hookom

I'm not sure why you posted this in the Reports NG, however your values are
being evaluated as text/strings. If you had shared your "code using Visual
basic on an after update and after enter event", I think someone could have
corrected it for you.
 
H

hugz via AccessMonster.com

My code is just simple. If [amountpurchased] > [invtylevel] then
Message...
else
Me.commandbuttonadd.enable = true
end if.

sorry i can't memorize the code on the message part but i think its correct..
now can u see what's wrong? thnx..
 
D

Duane Hookom

Try something like:
If Val([amountpurchased]) > Val([invtylevel]) then
Message...
else
Me.commandbuttonadd.enable = true
end if
 

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